Skip to content
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

Body contains % , as JSON, UriUtils.decode error #916

Closed
pinkhello opened this issue Mar 6, 2019 · 4 comments · Fixed by #931
Closed

Body contains % , as JSON, UriUtils.decode error #916

pinkhello opened this issue Mar 6, 2019 · 4 comments · Fixed by #931
Labels
waiting for feedback Issues waiting for a response from either to the author or other maintainers

Comments

@pinkhello
Copy link

Request Body
{ "percent" : "100%", "name" : "lee" }

Feign client declarative invocation will decode throw exception
URLDecoder.decode() code throw new IllegalArgumentException( "URLDecoder: Illegal hex characters in escape " + "(%) pattern - negative value");

UriUtils.decode() should be contain IllegalArgumentException, return the original value .

@kdavisk6
Copy link
Member

kdavisk6 commented Mar 8, 2019

Can you please provide a test case for this? Data provided either through the @BodyTemplate or @Body annotations are not encoded.

@kdavisk6 kdavisk6 added the waiting for feedback Issues waiting for a response from either to the author or other maintainers label Mar 8, 2019
@pinkhello
Copy link
Author

pinkhello commented Mar 10, 2019

Data provided the @Body annotations are not encoded.
core/src/test/java/feign/TargetTest.java

@kdavisk6
Copy link
Member

That’s intentional. @Body values are sent in the Request Body and are not encoded. Only @param values placed on the uri are encoded.

@pinkhello
Copy link
Author

That’s intentional. @Body values are sent in the Request Body and are not encoded. Only @param values placed on the uri are encoded.

@Body values are not encoded. But BodyTemplate.expand(Map<String, ?> variables) method will decode @Body values.

kdavisk6 added a commit to kdavisk6/feign that referenced this issue Mar 27, 2019
Fixes OpenFeign#916

In certain cases, a Body Template will contain a JSON payload.  To
support this we are asking users to pct-encode the beginning and the
end of the JSON object when providing it to the RequestLine so we don't
reject it as an expression.  Doing this requires that the we decode those
markers before submitting the request.

This change updates that logic to only decode the first and last characters
only and not decode the entire payload, since Body values don't require
any type of encoding.
kdavisk6 added a commit to kdavisk6/feign that referenced this issue Mar 27, 2019
Fixes OpenFeign#916

In certain cases, a Body Template will contain a JSON payload.  To
support this we are asking users to pct-encode the beginning and the
end of the JSON object when providing it to the RequestLine so we don't
reject it as an expression.  Doing this requires that the we decode those
markers before submitting the request.

This change updates that logic to only decode the first and last characters
only and not decode the entire payload, since Body values don't require
any type of encoding.
kdavisk6 added a commit to kdavisk6/feign that referenced this issue Mar 27, 2019
Fixes OpenFeign#916

In certain cases, a Body Template will contain a JSON payload.  To
support this we are asking users to pct-encode the beginning and the
end of the JSON object when providing it to the RequestLine so we don't
reject it as an expression.  Doing this requires that the we decode those
markers before submitting the request.

This change updates that logic to only decode the first and last characters
only and not decode the entire payload, since Body values don't require
any type of encoding.
kdavisk6 added a commit that referenced this issue Apr 8, 2019
Removed decoding from Body Template Expansion

Fixes #916

In certain cases, a Body Template will contain a JSON payload.  To
support this we are asking users to pct-encode the beginning and the
end of the JSON object when providing it to the RequestLine so we don't
reject it as an expression.  Doing this requires that the we decode those
markers before submitting the request.

This change updates that logic to only decode the first and last characters
only and not decode the entire payload, since Body values don't require
any type of encoding.
velo pushed a commit that referenced this issue Oct 7, 2024
Removed decoding from Body Template Expansion

Fixes #916

In certain cases, a Body Template will contain a JSON payload.  To
support this we are asking users to pct-encode the beginning and the
end of the JSON object when providing it to the RequestLine so we don't
reject it as an expression.  Doing this requires that the we decode those
markers before submitting the request.

This change updates that logic to only decode the first and last characters
only and not decode the entire payload, since Body values don't require
any type of encoding.
velo pushed a commit that referenced this issue Oct 8, 2024
Removed decoding from Body Template Expansion

Fixes #916

In certain cases, a Body Template will contain a JSON payload.  To
support this we are asking users to pct-encode the beginning and the
end of the JSON object when providing it to the RequestLine so we don't
reject it as an expression.  Doing this requires that the we decode those
markers before submitting the request.

This change updates that logic to only decode the first and last characters
only and not decode the entire payload, since Body values don't require
any type of encoding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Issues waiting for a response from either to the author or other maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants