1. 將下面的代碼保存爲一個*.xml的文件工具
<?xml version='1.0' encoding='UTF-8' ?> <?charles serialisation-version='2.0' ?> <rewriteSet-array> <rewriteSet> <active>true</active> <name>modify content-type</name> <hosts> <locationPatterns> <locationMatch> <location> <host>xdcs-collector.ximalaya.com</host> </location> <enabled>true</enabled> </locationMatch> </locationPatterns> </hosts> <rules> <rewriteRule> <active>true</active> <ruleType>3</ruleType> <matchHeader>Content-Type</matchHeader> <matchValue>.*</matchValue> <matchHeaderRegex>true</matchHeaderRegex> <matchValueRegex>true</matchValueRegex> <matchRequest>true</matchRequest> <matchResponse>false</matchResponse> <newHeader>Content-Type</newHeader> <newValue>text/plain;charset=utf-8</newValue> <newHeaderRegex>false</newHeaderRegex> <newValueRegex>false</newValueRegex> <matchWholeValue>false</matchWholeValue> <caseSensitive>true</caseSensitive> <replaceType>1</replaceType> </rewriteRule> </rules> </rewriteSet> </rewriteSet-array>
2. 打開 charles 工具->Tools->rewrite->import導入上述文件便可。spa