use of javax.annotation.ParametersAreNonnullByDefault in project FlareBot by FlareBot.
the class GzipRequestInterceptor method intercept.
@Override
@ParametersAreNonnullByDefault
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
if (originalRequest.body() == null || originalRequest.header("Content-Encoding") == null || !originalRequest.header("Content-Encoding").equals("gzip")) {
return chain.proceed(originalRequest);
}
Request compressedRequest = originalRequest.newBuilder().method(originalRequest.method(), gzip(originalRequest.body())).build();
return chain.proceed(compressedRequest);
}
Aggregations