New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give more options to DecodingClient
#3348
Labels
Milestone
Comments
ikhoon
added a commit
to ikhoon/armeria
that referenced
this issue
Mar 6, 2021
Motivation: Currently, `DecodingClient` does nothing if an accept-encoding is specified. https://github.com/line/armeria/blob/6da4e23b198cb769bc97dfe23f4e2eaed73254bf/core/src/main/java/com/linecorp/armeria/client/encoding/DecodingClient.java#L87-L90 However, some users might want to specify accept-encoding header and decode the response content using `DecodingClient`. Modifications: - Add `DecodingClientBuilder` in order to fluently build a `DecodingClient` with various options. - Add `autoFillAcceptEncoding(boolean)` to `DecodingClientBuilder` - If this option is disabled, `DecodingClient` will respect user-defined accept-encoding header - Add `strictContentEncoding(boolean)` to `DecodingClientBuilder` - If this option is enabled and unsupported encoding is received from an abnormal server, a response is failed with `UnsupportedEncodingException` Result: - You can now fluently build `DecodingClient` using `DecodingClientBuilder`. ```java DecodingClient.builder() .autoFillAcceptEncoding(false) .strictContentEncoding(true) .newDecorator(); ``` - Fixes line#3348
ikhoon
added a commit
to ikhoon/armeria
that referenced
this issue
Mar 6, 2021
Motivation: Currently, `DecodingClient` does nothing if an accept-encoding is specified. https://github.com/line/armeria/blob/6da4e23b198cb769bc97dfe23f4e2eaed73254bf/core/src/main/java/com/linecorp/armeria/client/encoding/DecodingClient.java#L87-L90 However, some users might want to specify accept-encoding header and decode the response content using `DecodingClient`. Modifications: - Add `DecodingClientBuilder` in order to fluently build a `DecodingClient` with various options. - Add `autoFillAcceptEncoding(boolean)` to `DecodingClientBuilder` - If this option is disabled, `DecodingClient` will respect user-defined accept-encoding header - Add `strictContentEncoding(boolean)` to `DecodingClientBuilder` - If this option is enabled and unsupported encoding is received from an abnormal server, a response is failed with `UnsupportedEncodingException` Result: - You can now fluently build `DecodingClient` using `DecodingClientBuilder`. ```java DecodingClient.builder() .autoFillAcceptEncoding(false) .strictContentEncoding(true) .newDecorator(); ``` - Fixes line#3348
trustin
pushed a commit
that referenced
this issue
Mar 24, 2021
Motivation: Currently, `DecodingClient` does nothing if an accept-encoding is specified. https://github.com/line/armeria/blob/6da4e23b198cb769bc97dfe23f4e2eaed73254bf/core/src/main/java/com/linecorp/armeria/client/encoding/DecodingClient.java#L87-L90 However, some users might want to specify accept-encoding header and decode the response content using `DecodingClient`. Modifications: - Add `DecodingClientBuilder` in order to fluently build a `DecodingClient` with various options. - Add `autoFillAcceptEncoding(boolean)` to `DecodingClientBuilder` - If this option is disabled, `DecodingClient` will respect user-defined accept-encoding header - Add `strictContentEncoding(boolean)` to `DecodingClientBuilder` - If this option is enabled and unsupported encoding is received from an abnormal server, a response is failed with `UnsupportedEncodingException` Result: - You can now fluently build `DecodingClient` using `DecodingClientBuilder`. ```java DecodingClient.builder() .autoFillAcceptEncoding(false) .strictContentEncoding(true) .newDecorator(); ``` - Fixes #3348
ikhoon
added a commit
to ikhoon/sttp
that referenced
this issue
May 7, 2021
Motivation: line/armeria#3348 has been fixed. `HttpDecordingClient` which could be replaced with Armeria's built-in `DecodingClient`. Modifications: - Remove `HttpDecodingClient` in favor of Armeria's `DecodingClient` - Use `StreamMessage.of(Path)` instead of additional parameters Result: Clean up workarounds.
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A
DecodingClient
does nothing if anAccept-Encoding
header is provided. TheDecodingClient
only works if anAccept-Encoding
header is absent. It will send all possible accept encodings.armeria/core/src/main/java/com/linecorp/armeria/client/encoding/DecodingClient.java
Lines 87 to 90 in e729261
Sometimes users may want to dynamically choose accept-encodings using an
Accept-Encoding
header.When unsupported
Content-Encoding
is received, aDecodingClient
silently skip decoding. It would good that users decide whether to ignore it or returns failed response.armeria/core/src/main/java/com/linecorp/armeria/client/encoding/HttpDecodedResponse.java
Lines 83 to 87 in ac398ea
We might give options by introducing
DecodingClientBuilder
. For example:The text was updated successfully, but these errors were encountered: