pod AF Networking text/html ContentTypes issue

37 Views Asked by At

We are using cocoapods in our project

pod 'AFNetworking', '~> 4.0.1'

AFURLResponseSerialization has the below acceptableContentTypes

- (instancetype)init {
    self = [super init];
    if (!self) {
        return nil;
    }

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

    return self;
}

API is getting failed with the error Request failed: unacceptable content-type: text/html

I have tried to set content type as text/HTML to the request, but it's not working.

[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

Is there any chance to add "text/html" to the acceptable content types.

Any help will be appreciated. Thanking you in advance.

0

There are 0 best solutions below