forked from loafle/openapi-generator-original
fix header parameter in ts fetch
This commit is contained in:
parent
dee2dd8d36
commit
5a5d3fd5e5
@ -102,16 +102,16 @@ export const {{classname}}FetchParamCreactor = {
|
||||
fetchOptions.body = JSON.stringify(params["{{paramName}}"] || {});
|
||||
}{{/bodyParam}}
|
||||
{{/hasBodyParam}}
|
||||
{{#hasHeaderParam}}
|
||||
{{#hasHeaderParams}}
|
||||
fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ {{#headerParams}}
|
||||
"{{baseName}}": params.{{paramName}},{{/headerParams}}
|
||||
}, contentTypeHeader);
|
||||
{{/hasHeaderParam}}
|
||||
{{^hasHeaderParam}}
|
||||
{{/hasHeaderParams}}
|
||||
{{^hasHeaderParams}}
|
||||
if (contentTypeHeader) {
|
||||
fetchOptions.headers = contentTypeHeader;
|
||||
}
|
||||
{{/hasHeaderParam}}
|
||||
{{/hasHeaderParams}}
|
||||
return {
|
||||
url: url.format(urlObj),
|
||||
options: fetchOptions,
|
||||
|
@ -144,9 +144,9 @@ export const PetApiFetchParamCreactor = {
|
||||
let fetchOptions: RequestInit = { method: "DELETE" };
|
||||
|
||||
let contentTypeHeader: Dictionary<string>;
|
||||
if (contentTypeHeader) {
|
||||
fetchOptions.headers = contentTypeHeader;
|
||||
}
|
||||
fetchOptions.headers = assign({
|
||||
"api_key": params.apiKey,
|
||||
}, contentTypeHeader);
|
||||
return {
|
||||
url: url.format(urlObj),
|
||||
options: fetchOptions,
|
||||
|
@ -143,9 +143,9 @@ export const PetApiFetchParamCreactor = {
|
||||
let fetchOptions: RequestInit = { method: "DELETE" };
|
||||
|
||||
let contentTypeHeader: Dictionary<string>;
|
||||
if (contentTypeHeader) {
|
||||
fetchOptions.headers = contentTypeHeader;
|
||||
}
|
||||
fetchOptions.headers = Object.assign({
|
||||
"api_key": params.apiKey,
|
||||
}, contentTypeHeader);
|
||||
return {
|
||||
url: url.format(urlObj),
|
||||
options: fetchOptions,
|
||||
|
@ -144,9 +144,9 @@ export const PetApiFetchParamCreactor = {
|
||||
let fetchOptions: RequestInit = { method: "DELETE" };
|
||||
|
||||
let contentTypeHeader: Dictionary<string>;
|
||||
if (contentTypeHeader) {
|
||||
fetchOptions.headers = contentTypeHeader;
|
||||
}
|
||||
fetchOptions.headers = assign({
|
||||
"api_key": params.apiKey,
|
||||
}, contentTypeHeader);
|
||||
return {
|
||||
url: url.format(urlObj),
|
||||
options: fetchOptions,
|
||||
|
Loading…
x
Reference in New Issue
Block a user