You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're currently using the jersey-client-2.25.1 in our project and we did an update of the openapi-generator-cli-4.2.3 for generating our api clients.
In the old version of the generator the parameter for the accept header for a DELETE request looked like this:
final String[] localVarAccepts = {
"application/json", "application/xml"
};
in the new version they changed it to:
final String[] localVarAccepts = {
};
The values of these arrays were merged to a comma separated string and passed to the accept method of the ClientRequest.class:
/**
* Add new accepted types to the message headers.
*
* @param types accepted types to be added.
*/
public void accept(final String... types) {
getHeaders().addAll(HttpHeaders.ACCEPT, (Object[]) types);
}
The problem is that the REST web service which we're targeting can't handle empty 'Accept' headers, and in my opinion it shouldn't be able to, since the 'Accept' header shouldn't be set on the DELETE request if the input value is empty or null. Therefore it would be great if there is a way to tell Jersey not to add the default value or an empty header when a null or an empty string is used.
The text was updated successfully, but these errors were encountered:
In 2.25.1, there used to work HeaderDelegateProvider SPI that may help you. Just the first idea without fully understanding the problem.
The other possibility is to add a @PreMatchingContainerRequestContext that would remove the empty/null header before the request hits your service. Or perhaps ClientRequestFilter with priority after the generator.
Therefore it would be great if there is a way to tell Jersey not to add the default value or an empty header when a null or an empty string is used.
This is tricky. Filtering the accept method values is possible, but it will not work in cases where getHeaders().add(HttpHeaders.ACCEPT, ""); is called directly.
Hello!
We're currently using the jersey-client-2.25.1 in our project and we did an update of the openapi-generator-cli-4.2.3 for generating our api clients.
In the old version of the generator the parameter for the accept header for a DELETE request looked like this:
in the new version they changed it to:
The values of these arrays were merged to a comma separated string and passed to the accept method of the ClientRequest.class:
The problem is that the REST web service which we're targeting can't handle empty 'Accept' headers, and in my opinion it shouldn't be able to, since the 'Accept' header shouldn't be set on the DELETE request if the input value is empty or null. Therefore it would be great if there is a way to tell Jersey not to add the default value or an empty header when a null or an empty string is used.
The text was updated successfully, but these errors were encountered: