Open mattiasgreen opened 1 year ago
Snippet from generated selectHeaderAccept()
public String selectHeaderAccept(String[] accepts) {
if (accepts.length == 0) {
return null;
}
for (String accept : accepts) {
if (isJsonMime(accept)) {
return accept;
}
}
return StringUtil.join(accepts, ",");
}
Snippet from generated getExternalTaskErrorDetailsCall()
final String[] localVarAccepts = {
"text/plain", "application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
Note that this results in localVarAccept
variable value "application/json"
, instead of "text/plain, application/json"
Temporary local workaround is to patch this generated file, either by editing or overriding this method.
final String[] localVarAccepts = {
"text/plain", "application/json"
};
final String localVarAccept = StringUtil.join(localVarAccepts, ",");
Alternatives for permanent fix, top of my head:
Found this open issue which is spot on. "[BUG][Go] Content type selection breaks when multiple content types present" https://github.com/OpenAPITools/openapi-generator/issues/10340
Requests to ExternalTaskApi.getExternalTaskErrorDetails(externalTaskId) fail with HTTP 406 Not Acceptable due to accept header value incorrectly listing only "application/json". Correct value is "application/json, text/plain".