Gargoyle
Gargoyle

Reputation: 10324

Remove Accept-Encoding from Alamofire

By default Alamofire is sending an Accept-Encoding header that includes gzip. How do I tell it to stop doing that? I do accept gzip, and I'm glad to have Alamofire parse it out for me, but when you send that header, ngix immediately removes the Content-Length header (ARGH!!!!) and that breaks things for me.

Upvotes: 5

Views: 1270

Answers (1)

Boaz Saragossi
Boaz Saragossi

Reputation: 988

I found that alamofire adds the following headers:

Accept-Language: en;q=1.0

Accept-Encoding: gzip;q=1.0, compress;q=0.5

the q= part was the problematic part and what caused my server to return an error.

To solve it i added my own Accept-Language and Accept-Encoding headers to override the default headers. mine were without the q= part.

    headers["Accept-Language"] = "en"
    headers["Accept-Encoding"] = "gzip"

That did the trick, hope it will be of help to someone.

Upvotes: 1

Related Questions