mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 01:26:16 +00:00
[JavaScript] Avoid setting Content-Type header if body is not used (#5344)
This commit is contained in:
@@ -449,8 +449,6 @@
|
||||
if(contentType != 'multipart/form-data') {
|
||||
request.type(contentType);
|
||||
}
|
||||
} else if (!request.header['Content-Type']) {
|
||||
request.type('application/json');
|
||||
}
|
||||
|
||||
if (contentType === 'application/x-www-form-urlencoded') {
|
||||
@@ -468,6 +466,9 @@
|
||||
}
|
||||
}
|
||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||
if (!request.header['Content-Type']) {
|
||||
request.type('application/json');
|
||||
}
|
||||
request.send(bodyParam);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user