retrofit + okhttp : Retrieve GZIPInputStream

后端 未结 4 1331
自闭症患者
自闭症患者 2021-02-19 19:33

I have a problem when i activate gzip on WS using retrofit 1.4.1 and okhttp 1.3.0.

RequestInterceptor requestInterceptor = new RequestInterceptor() {
                    


        
4条回答
  •  花落未央
    2021-02-19 20:01

    Just omit the accept-encoding header from your code. OkHttp will add its own accept-encoding header, and if the server responds with gzip then OkHttp will silently unzip it for you.

提交回复
热议问题