Missing = character for query parameters when value is empty
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
Hello,
I have been upgrading feign from 10.1.0 to 11.8 and I noticed a change of behavior when empty parameters are passed.
Here is an example with a dummy interface :
public interface FeignClient {
@RequestLine("GET /path?param={param}")
void call(@Param("param") String value);
}
On the previous version, when calling the client with an empty string as the parameter value, feign would perform a request on :
/path
With feign 11.10, the actual request is now performed on :
/path?param
I understand that it is an expected behavior that empty strings are not ignored anymore. However I'm surprised that the '=' symbol is removed from the query.
As I checked the RFC 6570 standard, I understood that the ideal target would be to write the request line as
@RequestLine("GET /path{?param}")
when this is supported. In the standard the '=' signs would be present for empty values.
I am curious to get your opinion on this. Do you consider the current behavior as a defect or an expected behavior ?
To give more context I detected this because of unit tests that use PACT to align on a REST contract. PACT's mock server fails to parse the query as it looks explicitly for key/value pairs separated with '&' and '='
I attach a zip with a basic maven project to reproduce the case :
feign-query-case.zip
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 with the attached feign-query-case.zip Maven reproduction and inspect how the Feign client builds the request URI for an empty @Param value. Compare the generated /path?param with the expected /path?param= and confirm the behavior against the relevant URI-template or query-parameter tests, if present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100