mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 10:26:13 +00:00
[JavaScript] Avoid setting Content-Type header if body is not used (#5344)
This commit is contained in:
@@ -459,8 +459,6 @@
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -478,6 +476,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -421,8 +421,6 @@ class ApiClient {
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -440,6 +438,9 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,8 +408,6 @@ class ApiClient {
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -427,6 +425,9 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -400,8 +400,6 @@ class ApiClient {
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -419,6 +417,9 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -449,8 +449,6 @@
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -468,6 +466,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -458,8 +458,6 @@
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -477,6 +475,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -409,8 +409,6 @@ class ApiClient {
|
|||||||
if(contentType != 'multipart/form-data') {
|
if(contentType != 'multipart/form-data') {
|
||||||
request.type(contentType);
|
request.type(contentType);
|
||||||
}
|
}
|
||||||
} else if (!request.header['Content-Type']) {
|
|
||||||
request.type('application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType === 'application/x-www-form-urlencoded') {
|
if (contentType === 'application/x-www-form-urlencoded') {
|
||||||
@@ -428,6 +426,9 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (bodyParam !== null && bodyParam !== undefined) {
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
||||||
|
if (!request.header['Content-Type']) {
|
||||||
|
request.type('application/json');
|
||||||
|
}
|
||||||
request.send(bodyParam);
|
request.send(bodyParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user