ASIHTTPRequest Returning HTML instead of JSON

删除回忆录丶 提交于 2019-12-06 06:30:07

Did you check that the headers sent using your browser are also the same as when you send the request by code?

Especially did you try to add the "Accept" header to your request to define that you accept the json Content-Type?

[request addRequestHeader:@"Accept" value:@"application/json"];

Try using a tool like wireshark or charlesproxy to compare the working requests from your browser/postie, and compare them to the non-working requests from ASIHTTPRequest - once you spot what's different it should be easy to fix.

AliSoftware's suggestion is one of the most likely differences you'll see, but it's possible there are other things too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!