Remove Accept-Encoding from Alamofire

By default, Alamofire sends an Accept-Encoding header, which includes gzip. How can I say stop doing this? I accept gzip and I'm glad that Alamofire parsed it for me, but when you send this header, ngix immediately removes the Content-Length header (ARGH !!!!) and it breaks me.

+4
source share
1 answer

I found that alamofire adds the following headers:

Accept-Language: en; q = 1.0

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

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

, Accept-Language Accept-Encoding, . q = .

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

, , -.

0

Source: https://habr.com/ru/post/1616149/


All Articles