forked from loafle/openapi-generator-original
[JavaScript] Avoid setting Content-Type header if body is not used (#5344)
This commit is contained in:
@@ -408,8 +408,6 @@ class ApiClient {
|
||||
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') {
|
||||
@@ -427,6 +425,9 @@ class ApiClient {
|
||||
}
|
||||
}
|
||||
} 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