How to print NSMutableURLRequest using NSLog ?
How to print NSMutableURLRequest?
Asked Answered
.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
Did you try with
NSLog(@" %@", myMutableURLRequest);
request = <NSMutableURLRequest 112.152.8.204/Service1.asmx> This is wat am getting in logs. But I need to see the values added to it including header settings :( –
Triangular
@chaitanya: If you want to make sure you get the headers out, you need to edit your question to say so. As it stands, this is the correct answer (hence +1 from me). –
Manicure
#chaitanya : i meant your NSMutableURLRequest values :) –
Profluent
© 2022 - 2024 — McMap. All rights reserved.