如何打印NSMutableURLRequest? [英] How to print NSMutableURLRequest?

查看:134
本文介绍了如何打印NSMutableURLRequest?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用NSLog打印NSMutableURLRequest?

How to print NSMutableURLRequest using NSLog ?

推荐答案

.allHTTPHeaderFields 返回带有标题内容的字典:

.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" = "...";
// }

或特定字段:

NSString *field = @"Content-Type";
NSLog(@"%@",[request valueForHTTPHeaderField:field]);
// multipart/form-data; boundary=Boundary+D90A259975186725

这篇关于如何打印NSMutableURLRequest?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆