我正在尝试将我的Android项目迁移到OkHttp。
我想知道的是,OkHttp是否会使用gzip压缩我的POST
请求主体?
我像这样使用它(来自首页的示例):
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
如果json数据足够大,那么这个RequestBody
会自动gzip压缩吗?还是我需要手动进行压缩呢?就像我之前使用AndroidHttpClient
做的那样:
AndroidHttpClient.getCompressedEntity(json, context.getContentResolver())
如果需要手动完成,最好的方法是什么?
谢谢!