如何删除HTTP请求的一些标头?

时间:2023-01-09 20:16:06

I need to remove some of the headers, e.g. Accept, Accept-Language, etc. from an HTTP request being sent from iPhone to server.

我需要删除一些标题,例如从从iPhone发送到服务器的HTTP请求接受,接受语言等。

NSMutableURLRequest and CFHTTPMessageRef don't have a way to override what is being sent in the header. It seems like there is no easy way to approach that.

NSMutableURLRequest和CFHTTPMessageRef没有办法覆盖标头中发送的内容。似乎没有简单的方法来解决这个问题。

Any suggestions?

1 个解决方案

#1


Have you tried using -setAllHTTPHeaderFields? The docs say it replaces all current fields (rather than appending).

您是否尝试过使用-setAllHTTPHeaderFields?文档说它取代了所有当前字段(而不是附加)。

#1


Have you tried using -setAllHTTPHeaderFields? The docs say it replaces all current fields (rather than appending).

您是否尝试过使用-setAllHTTPHeaderFields?文档说它取代了所有当前字段(而不是附加)。