Skip to content

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

Open
krahulshharmaa wants to merge 2 commits into
lysine-dev:mainfrom
krahulshharmaa:feature/brotli-logging
Open

krahulshharmaa wants to merge 2 commits into
lysine-dev:mainfrom
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.

@yschimke yschimke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this change is complete, it's going to log without decoding.

I think if we really want this, and I'm not sure we do. Then we need to teach HttpLoggingInterceptor about the compression algorithms.

But in development, you can always order the decompression before this.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants