-
Notifications
You must be signed in to change notification settings - Fork 566
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
[4.x] WebClient should have a mode that is resilient to bad media/content types #6774
Comments
Related to #3956 |
I'll have a look a this one. |
@tomas-langer @trentjeff Just small design note. |
The default setup of the WebClient must work out of the box. |
@romain-grecourt You are right.
And it passes without any modifications of the Nima WebClient. @trentjeff So now I'm not sure what this relaxed mode shall exactly do. Client does not throw anything and header String contains value from server. Do we really need to rewrite this header value to text/plain? I don't think it's a good idea. |
@trentjeff Now I got it from Tomas L. message. It's just about the simple |
Sounds good to me. |
…t to bad media/content types Signed-off-by: Tomáš Kraus <tomas.kraus@oracle.com>
…t to bad media/content types Signed-off-by: Tomáš Kraus <tomas.kraus@oracle.com>
…t to bad media/content types Signed-off-by: Tomáš Kraus <tomas.kraus@oracle.com>
…edia/content types Signed-off-by: Tomáš Kraus <tomas.kraus@oracle.com>
Seems like we might also want the enhancement for the server, see #7053 |
And, we might want to consider backporting this to 3.x and 2.x |
Here is a snippet of an HTTP response from a server:
Some parts were removed for privacy issues
As you will notice the server is returning an invalid content type of
text
- see https://www.iana.org/assignments/media-types/media-types.xhtml#text for a list of all valid media/content types.Our WebClient should support a mode (e.g.,
relaxed
mode vs the current mode which I'll callstrict
) that will log a warning about these invalid usages, but should not throw an exception. Even nicer would be to translatetext
->text/plain
for this specific case inrelaxed
mode.I was able to reproduce this exception behavior in the following unit test of
MediaTypeTest
on main:If we are in a relaxed mode, the WebClient should not throw an exception - we should just log a warning. Doing so will make Helidon more resilient for users to consume since they currently have no other workaround other than to switch to HttpClient, etc.
Here is the full exception reported by the user from 3.1.0:
The text was updated successfully, but these errors were encountered: