ASIHTTPRequest debugging
I'm using ASIHTTPRequest in my iOS project. i would like to see all the http headers of my request to th开发者_如何学Pythone server. How I can see this with ASIHTTPRequest?
Is there any tool like fiddler in the mac?
Thanks for your answer
You can also set the following macro below which is found in ASIHTTPRequestConfig.h, I've used this to help with debugging HTTP headers.
#define DEBUG_REQUEST_STATUS 1
There is a requestHeaders
property. It is NSMutableDictionary
, so you can iterate through it. Dictionary key is name of header and dictionary value for this key is value of header with this name.
You can just print them out:
// headers in server response
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSLog(@"headers: %@", [request responseHeaders]);
}
And to see the headers of your request:
NSLog(@"headers: %@", [request requestHeaders]);
精彩评论