Skip to content

HttpLoggingInterceptor: Recognize "br" (Brotli) as a known encoding#9420

Open
krahulshharmaa wants to merge 1 commit intosquare:masterfrom
krahulshharmaa:feature/brotli-logging
Open

HttpLoggingInterceptor: Recognize "br" (Brotli) as a known encoding#9420
krahulshharmaa wants to merge 1 commit intosquare:masterfrom
krahulshharmaa:feature/brotli-logging

Conversation

@krahulshharmaa
Copy link
Copy Markdown

Previously, HttpLoggingInterceptor treated "br" (Brotli) as an unknown
content encoding and skipped logging the response body by emitting:
"<-- END HTTP (encoded body omitted)".

OkHttp supports Brotli via the optional BrotliInterceptor and includes
"br" in accepted encodings. Treating it as unknown is therefore inconsistent.

This change updates the interceptor to recognize "br" as a known encoding,
allowing it to follow the normal logging flow (similar to "gzip").

Note:
This change does not add Brotli decompression. If BrotliInterceptor is
not used, the response body may still be logged as binary.

Tests are updated to use a truly unknown encoding ("xyz") to preserve
the original intent of verifying unknown encoding handling.

content encoding and skipped logging the response body by emitting:
"<-- END HTTP (encoded body omitted)".

OkHttp supports Brotli via the optional BrotliInterceptor and includes
"br" in accepted encodings. Treating it as unknown is therefore inconsistent.

This change updates the interceptor to recognize "br" as a known encoding,
allowing it to follow the normal logging flow (similar to "gzip").

Note:
This change does not add Brotli decompression. If BrotliInterceptor is
not used, the response body may still be logged as binary.

Tests are updated to use a truly unknown encoding ("xyz") to preserve
the original intent of verifying unknown encoding handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants