How to add lowercase field to NSURLRequest header field?

三世轮回 提交于 2019-12-04 13:13:40

HTTP header fields are supposed to be case insensitive, so you need to fix your API.

I have written a blog post on the topic: Fixing -[NSMutableURLRequest setValue:forHTTPHeaderField:] I suggest you to read it. You will learn how to fix this problem and why you should not fix it.

can u please try with addValue(_:forHTTPHeaderField:)?

NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:
[NSURL URLWithString:MyURLString]];
[urlRequest addValue:@"aValue" forHTTPHeaderField:@"field"];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!