问题
How to print NSMutableURLRequest using NSLog ?
回答1:
.allHTTPHeaderFields
returns a dictionary with the header content:
NSLog(@"%@", [request allHTTPHeaderFields]);
// {
// "Accept-Language" = "en;q=1";
// "Content-Length" = 190706;
// "Content-Type" = "multipart/form-data; boundary=Boundary+D90A259975186725";
// "User-Agent" = "...";
// }
Or for specific field:
NSString *field = @"Content-Type";
NSLog(@"%@",[request valueForHTTPHeaderField:field]);
// multipart/form-data; boundary=Boundary+D90A259975186725
回答2:
Did you try with
NSLog(@" %@", myMutableURLRequest);
来源:https://stackoverflow.com/questions/5787010/how-to-print-nsmutableurlrequest