I created a Java client with the swagger-codegen-maven-plugin
and I am setting custom headers over the ApiClient
. But when looking at the request, I see that the headers are set but use the header key as value parameter.
swagger-codegen-maven-plugin: 2.3.1
with:
<configuration>
<inputSpec>...</inputSpec>
<language>java</language>
<output>...</output>
...
<configOptions>
<library>resteasy</library>
<java8>true</java8>
...
<configOptions>
<configuration>
Example
When performing a request with the configured client.
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.addDefaultHeader("headerKey1", "headerValue1");
defaultClient.addDefaultHeader("headerKey2", "headerValue2");
..some request.
The reuqest has the following headers:
whereas it should be :
ApiClient.java:
public <T> T invokeAPI(String path, .... ) {
...
for (Entry<String, String> defaultHeaderEnrty: defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(defaultHeaderEnrty.getKey())) {
########################
String value = defaultHeaderEnrty.getKey(); <=== This should use the value.
########################
if (value != null) {
invocationBuilder = invocationBuilder.header(defaultHeaderEnrty.getKey(), value);
}
}
}
...
}
Pull Request
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4