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 Template Expansion with nested JSON #1129

Closed
garcia-jj opened this issue Dec 12, 2019 · 2 comments · Fixed by #1140
Closed

Body Template Expansion with nested JSON #1129

garcia-jj opened this issue Dec 12, 2019 · 2 comments · Fixed by #1140
Assignees
Labels
bug Unexpected or incorrect behavior feedback provided Feedback has been provided to the author help wanted Issues we need help with tackling

Comments

@garcia-jj
Copy link

garcia-jj commented Dec 12, 2019

When I'm trying to upgrade from Feign 10.2.0 to 10.7.0 I'm facing an error to decode my body template.

The needed literal JSON is:

{"resize": {"method": "fit","width": 150,"height": 150}}

So I wrote the method as:

@Body("%7B\"resize\": %7B\"method\": \"fit\",\"width\": {size},\"height\": {size}%7D%7D")
void resize(@Param("file") String file, @Param("size") int size, @Param("target") String target);

It works fine. But during the upgrate to 10.7.0 I got the following JSON:

{"resize": %7B"method": "fit","width": 150,"height": 150%7D}

As I see, the 10.7.0 are not expanding JSON escape as 10.2.0. This behavior may be introduced with this change: #931

@kdavisk6 kdavisk6 added question General usage or 'how-to' questions bug Unexpected or incorrect behavior feedback provided Feedback has been provided to the author help wanted Issues we need help with tackling and removed question General usage or 'how-to' questions labels Dec 23, 2019
@kdavisk6
Copy link
Member

This appears to be a gap in our test coverage. Thank you for reporting this.

@kdavisk6 kdavisk6 self-assigned this Dec 26, 2019
kdavisk6 added a commit to kdavisk6/feign that referenced this issue Dec 26, 2019
Fixes OpenFeign#1129

When JSON is detected in a Body Template, all start and end tokens
that may have been pct-encoded are decoded, ensuring that the
expanded result is valid JSON.
kdavisk6 added a commit to kdavisk6/feign that referenced this issue Dec 26, 2019
Fixes OpenFeign#1129

When JSON is detected in a Body Template, all start and end tokens
that may have been pct-encoded are decoded, ensuring that the
expanded result is valid JSON.
kdavisk6 added a commit that referenced this issue Dec 27, 2019
* Ensure all brackets are decoded in JSON based Body Templates

Fixes #1129

When JSON is detected in a Body Template, all start and end tokens
that may have been pct-encoded are decoded, ensuring that the
expanded result is valid JSON.
@kdavisk6
Copy link
Member

@garcia-jj This has been fixed and published to OSS as a SNAPSHOT. If you would like, you can test using version 10.7.1-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect behavior feedback provided Feedback has been provided to the author help wanted Issues we need help with tackling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants