Skip to content

Commit 91e2cd0

Browse files
committed
fix(net): remove gzip encoding in non-get requests
Mainly for POST requests where likely to have a redirect.
1 parent cede608 commit 91e2cd0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/shared/providers/net_client_provider/net_client_provider.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ final class _PointsChangesChecker extends Interceptor {
322322
final class _GzipEncodingChecker extends Interceptor with LoggerMixin {
323323
@override
324324
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
325-
if (options.uri.queryParameters['goto'] == 'findpost') {
325+
// Likely to have redirect on post methods.
326+
if (options.method != 'GET' || options.uri.queryParameters['goto'] == 'findpost') {
326327
info('removing gzip encoding in request');
327328
options.headers[HttpHeaders.acceptEncodingHeader] = 'deflate, br';
328329
}

0 commit comments

Comments
 (0)