Jak wydrukować NSMutableURLRequest?

Jak wydrukować NSMutableURLRequest za pomocą NSLog ?

Author: Oak Bytes, 2011-04-26

2 answers

.allHTTPHeaderFields zwraca słownik z zawartością nagłówka:

NSLog(@"%@", [request allHTTPHeaderFields]);
// {
//    "Accept-Language" = "en;q=1";
//    "Content-Length" = 190706;
//    "Content-Type" = "multipart/form-data; boundary=Boundary+D90A259975186725";
//    "User-Agent" = "...";
// }

Lub dla konkretnego pola:

NSString *field = @"Content-Type";
NSLog(@"%@",[request valueForHTTPHeaderField:field]);
// multipart/form-data; boundary=Boundary+D90A259975186725
 82
Author: visakh7,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-06-12 17:03:15

Czy próbowałeś z

NSLog(@" %@", myMutableURLRequest);
 2
Author: Jhaliya,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-04-26 07:07:46