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

Fix expansion of @RequestParam empty lists #1200

Merged
merged 5 commits into from Apr 19, 2020

Conversation

darrenfoong
Copy link
Contributor

@darrenfoong darrenfoong commented Mar 30, 2020

This PR addresses #1197.

Expressions.expandIterable() (link), expands an empty list into null, which gets returned to expand(), whose StringBuilder appends a null. StringBuilder will append a literal null to the internal string buffer, resulting in an expansion of an empty list into something like /items?manufacturer=null, which will be serialized by the caller as a singleton list with a single null.

This PR modifies expandIterable() to return an empty string instead of null in the case of an empty list.

Copy link
Member

@kdavisk6 kdavisk6 left a comment

Choose a reason for hiding this comment

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

Approved.

You are correct. We should not be treating an empty Collection as undefined.

@kdavisk6 kdavisk6 added ready to merge Will be merged if no other member ask for changes bug Unexpected or incorrect behavior labels Apr 6, 2020
@kdavisk6
Copy link
Member

kdavisk6 commented Apr 6, 2020

A note on Travis, the build succeeded however the status did not make it back to GitHub. This PR is green.

@kdavisk6 kdavisk6 merged commit dc081d1 into OpenFeign:master Apr 19, 2020
jebeaudet pushed a commit to coveord/feign that referenced this pull request Apr 24, 2020
* Add list tests to QueryTemplateTest

* Make expandIterable() return empty string if unresolved

* Rename new tests to fit existing tests

* Format code

* Fix newlines
@darrenfoong
Copy link
Contributor Author

I realised that I had been referencing the wrong issue all this time: it should be #1197 (which I created) and not #1194 (which was in the original pull request body).

I've updated the original comment and apologies for any confusion caused. In any case, this should close #1197? @kdavisk6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect behavior ready to merge Will be merged if no other member ask for changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants