spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.53k stars 3.33k forks source link

MVC ProxyExchange should support request body for GET requests #2185

Open masch712 opened 3 years ago

masch712 commented 3 years ago

Is your feature request related to a problem? Please describe. I've customized my RestTemplate to support request bodies for GET requests, but when ProxyExchange builds the request in its get() method, it doesn't include the body: https://github.com/spring-cloud/spring-cloud-gateway/blob/62f64ae80f78c6bd9dda91b6754be071c13907c1/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java#L273-L276

Describe the solution you'd like The solution might simply be to call .body(body()) in get() the same way it's done for other request methods.

Describe alternatives you've considered I looked into creating a ProxyExchange subclass, but the headers, body, and exchange methods are all private, so I believe it would be impossible or hacky to override the functionality of the get method.

Additional context N/A

manueldeveloper commented 3 years ago

@spencergibb maybe I can help with this issue

spencergibb commented 3 years ago

That's what the "help wanted" label means. PRs welcome.

manueldeveloper commented 3 years ago

Hi @spencergibb! I did this PR #2247 solving this issue