NSUrlRequest: where an app can find the default headers for HTTP request?

后端 未结 3 1415
有刺的猬
有刺的猬 2020-12-15 14:28

Does anybody know where an iOS app can see the default headers that NSUrlRequest sets for an HTTP request?

Just creating NSUrlRequest with

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 15:12

    That may be an overkill, but based on Matt Gallagher's blog post I've created even more simpler local HTTP listener and sent a separate [mutableCopy]ed request to it to be able to read and output all HTTP headers that this request has.

    Better solution must be to setup a local HTTP request catcher, it must look nicer I think, but for the scope of simple demo just to show all sent/received headers this solution is OK.

提交回复
热议问题