spring-cloud / spring-cloud/spring-cloud-gateway
MVC ProxyExchange should support request body for GET requests
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java at the get() method referenced in the issue. Compare how other request methods include the request body and check the existing MVC tests for ProxyExchange behavior. Done means GET proxy requests preserve the incoming body, with regression coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100