[manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/x-www-form-urlencoded",@"application/json",@"text/html",nil];
重要的是application/x-www-form-urlencoded正确的请求参数类型:
错误的请求参数类型,这是传进的字典,变成json,实际上应该是上面的文本类型
本文介绍了如何正确配置HTTP请求的Content-Type头信息,确保客户端与服务器之间的数据交互符合预期。重点对比了application/x-www-form-urlencoded与JSON数据类型的区别。
7万+

被折叠的 条评论
为什么被折叠?



