Custom headers set via baseOptions of a Configuration object are not present in the axios request. Expected behaviour: they are present ;).
4.1.2
any, can be used
any, can be used
Pass this Configuration to a *AxiosParamCreator, the axios request should contain the custom header but is doesn't.
new Configuration({
baseOptions: {
headers: {
'x-CUSTOM-VALUE': `xxx`,
},
},
})
https://github.com/johannes-darms/openapi-generator/commit/cd12d42df1cb139c1b16d80b4a8b9bc8425357f1
I think the problem is that
https://github.com/OpenAPITools/openapi-generator/blob/b69b8cdd31aef20bf41022d84df08bc62aca747e/samples/client/petstore/typescript-axios/builds/default/api.ts#L294
should be changed to something like
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...options.headers,
...(baseOptions ? baseOptions.headers : {})
};
@johannes-darms would you like to implement and test this fix in
https://github.com/OpenAPITools/openapi-generator/blob/b69b8cdd31aef20bf41022d84df08bc62aca747e/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache#L191
?
the suggested fix https://github.com/johannes-darms/openapi-generator/commit/cd12d42df1cb139c1b16d80b4a8b9bc8425357f1 looks good
would you like to file a PR?
the suggested fix johannes-darms@cd12d42 looks good
would you like to file a PR?
sure.
What is the status of this, was a PR ever created?
It looks like this commit fixes the issue: https://github.com/OpenAPITools/openapi-generator/commit/a4fc3195023dc0fd54944fb1cdf8f89bae0aa7ac
It seems safe to close this issue as a duplicate of https://github.com/OpenAPITools/openapi-generator/issues/5420