android - OkHttp, is the automatic GZIP disabled when using a custom interceptor? -
i using okhttp 2.3.0 in android app. question transparent gzip feature. according documentation, should silently there. cannot see ("accept-encoding", "gzip")
header in request.
i using custom interceptor add authentication:
@override public response intercept(chain chain) throws ioexception { request request = chain.request(); // 1. sign request [get token] if (!textutils.isempty(token)) { // have token. let's use sign request request = request.newbuilder() .header(auth_header_key, bearer_header_value + token) .build(); } // 2. proceed request log.d("t", "headers " + request.headers()); <--- no gzip header here response response = chain.proceed(request);
the log statement shows header have added:
authorization: bearer xxxxxxxxxxxxxxxxxxxxxxxxxx
but nothing gzip encoding. should else, or maybe header added after invoke chain.proceed(request)
?
the header added after chain.proceed()
. can see using network interceptor instead of application interceptor; see okhttp interceptors doc comparison of two.
Comments
Post a Comment