XMNetworking icon indicating copy to clipboard operation
XMNetworking copied to clipboard

how to set acceptableContentTypes?

Open hundredlee opened this issue 8 years ago • 2 comments

how i can set acceptableContentTypes .when the response data is not json?

error info: 
Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo={NSLocalizedDescription=Request failed: unacceptable content-type: text/html, NSErrorFailingURLKey=

hundredlee avatar Sep 26 '17 07:09 hundredlee

i use my way to deal with this problem. open the file XMEngine.m.In line 495 ,cancel this annotation .

_afJSONResponseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json",
 @"text/javascript", @"text/html", @"text/plain", nil];

it's a stupid way to deal.looking forward to the author to deal with it.thx

hundredlee avatar Oct 01 '17 16:10 hundredlee

[[XMEngine sharedEngine].sessionManager.requestSerializer setValue:@"whatyouwanttomodify" forHttpHeaderField:@"Content-Type"];

westke avatar Jan 12 '18 05:01 westke