swagger-api / swagger-api/swagger-codegen
Java "resteasy" ApiClient not adding default HTTP headers correctly
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
In the ApiClient.java file around line 592 the following code is responsible for adding the default http headers to the request.
for (Entry<String, String> defaultHeaderEnrty: defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(defaultHeaderEnrty.getKey())) {
String value = defaultHeaderEnrty.getKey();
if (value != null) {
invocationBuilder = invocationBuilder.header(defaultHeaderEnrty.getKey(), value);
}
}
}
The line "String value = defaultHeaderEnrty.getKey();" is wrong and should have been "String value = defaultHeaderEnrty.getValue();"
Swagger-codegen version
2.3.1
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
Open ApiClient.java around line 592 and inspect how defaultHeaderMap entries are used when building the request. Confirm the header value comes from each entry's value rather than its key, then verify that generated resteasy clients send configured default HTTP headers correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100