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

FeignClient request parameters not encoded as expected #128

Closed
englishteeth opened this issue Sep 19, 2017 · 6 comments
Closed

FeignClient request parameters not encoded as expected #128

englishteeth opened this issue Sep 19, 2017 · 6 comments
Labels
enhancement New feature or request

Comments

@englishteeth
Copy link

Just converted some code from using feign directly and I am seeing a difference in the url created that the server is rejecting.

Using feign to define the client:

@RequestLine("GET /calendar/events?zonedDateTime={zonedDateTime}")
List<Event> getEvents(@Param("zonedDateTime") ZonedDateTime zonedDateTime);

The date in the request is formatted
?zonedDateTime=2017-09-19T13:08:00.014%2B03:00[Europe/Athens]

Whereas using @FeignClient to define it:

@RequestMapping(method = RequestMethod.GET, value = "/calendar/events")
List<Event> getEvents(@RequestParam("zonedDateTime") ZonedDateTime zonedDateTime);

The date in the request is formatted
?zonedDateTime=2017-09-19T13:08:00.014+03:00[Europe/Athens]

The plus in the offset was encode by feign's @Param but not when using @RequestParam.

@englishteeth
Copy link
Author

englishteeth commented Nov 6, 2017

Not sure why an incorrectly formatted date is seen as an enhancement.
@FeignClient doesn't work for zoned dates.

@ryanjbaxter
Copy link
Contributor

I am wondering as well why the : aren't encoded as well in the Feign example.

@englishteeth
Copy link
Author

I'm afraid I have no firm answer to that. For the life of me, I cannot find the link, but I saw some reference stating that the the query string parameters do not need to be encoded (or at least to the same extent), so I spent quite a bit of time assuming that the @RequestMapping version of the request was correct and I had a server side problem because it was rejecting the request.

However, since you frequently have less control over the services you call than the clients you write to call them, my attention returned to the unexpected differences in the two client side calls.

@spencergibb spencergibb transferred this issue from spring-cloud/spring-cloud-netflix Jan 31, 2019
@spencergibb spencergibb added the enhancement New feature or request label Jan 31, 2019
@ryanjbaxter
Copy link
Contributor

Can you try with the latest release and if it still doesnt work provide a sample to reproduce the problem?

@ryanjbaxter ryanjbaxter added waiting for feedback enhancement New feature or request and removed enhancement New feature or request labels Jan 31, 2019
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants