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}}"] || {});
|
fetchOptions.body = JSON.stringify(params["{{paramName}}"] || {});
|
||||||
}{{/bodyParam}}
|
}{{/bodyParam}}
|
||||||
{{/hasBodyParam}}
|
{{/hasBodyParam}}
|
||||||
{{#hasHeaderParam}}
|
{{#hasHeaderParams}}
|
||||||
fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ {{#headerParams}}
|
fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ {{#headerParams}}
|
||||||
"{{baseName}}": params.{{paramName}},{{/headerParams}}
|
"{{baseName}}": params.{{paramName}},{{/headerParams}}
|
||||||
}, contentTypeHeader);
|
}, contentTypeHeader);
|
||||||
{{/hasHeaderParam}}
|
{{/hasHeaderParams}}
|
||||||
{{^hasHeaderParam}}
|
{{^hasHeaderParams}}
|
||||||
if (contentTypeHeader) {
|
if (contentTypeHeader) {
|
||||||
fetchOptions.headers = contentTypeHeader;
|
fetchOptions.headers = contentTypeHeader;
|
||||||
}
|
}
|
||||||
{{/hasHeaderParam}}
|
{{/hasHeaderParams}}
|
||||||
return {
|
return {
|
||||||
url: url.format(urlObj),
|
url: url.format(urlObj),
|
||||||
options: fetchOptions,
|
options: fetchOptions,
|
||||||
|
@ -144,9 +144,9 @@ export const PetApiFetchParamCreactor = {
|
|||||||
let fetchOptions: RequestInit = { method: "DELETE" };
|
let fetchOptions: RequestInit = { method: "DELETE" };
|
||||||
|
|
||||||
let contentTypeHeader: Dictionary<string>;
|
let contentTypeHeader: Dictionary<string>;
|
||||||
if (contentTypeHeader) {
|
fetchOptions.headers = assign({
|
||||||
fetchOptions.headers = contentTypeHeader;
|
"api_key": params.apiKey,
|
||||||
}
|
}, contentTypeHeader);
|
||||||
return {
|
return {
|
||||||
url: url.format(urlObj),
|
url: url.format(urlObj),
|
||||||
options: fetchOptions,
|
options: fetchOptions,
|
||||||
|
@ -143,9 +143,9 @@ export const PetApiFetchParamCreactor = {
|
|||||||
let fetchOptions: RequestInit = { method: "DELETE" };
|
let fetchOptions: RequestInit = { method: "DELETE" };
|
||||||
|
|
||||||
let contentTypeHeader: Dictionary<string>;
|
let contentTypeHeader: Dictionary<string>;
|
||||||
if (contentTypeHeader) {
|
fetchOptions.headers = Object.assign({
|
||||||
fetchOptions.headers = contentTypeHeader;
|
"api_key": params.apiKey,
|
||||||
}
|
}, contentTypeHeader);
|
||||||
return {
|
return {
|
||||||
url: url.format(urlObj),
|
url: url.format(urlObj),
|
||||||
options: fetchOptions,
|
options: fetchOptions,
|
||||||
|
@ -144,9 +144,9 @@ export const PetApiFetchParamCreactor = {
|
|||||||
let fetchOptions: RequestInit = { method: "DELETE" };
|
let fetchOptions: RequestInit = { method: "DELETE" };
|
||||||
|
|
||||||
let contentTypeHeader: Dictionary<string>;
|
let contentTypeHeader: Dictionary<string>;
|
||||||
if (contentTypeHeader) {
|
fetchOptions.headers = assign({
|
||||||
fetchOptions.headers = contentTypeHeader;
|
"api_key": params.apiKey,
|
||||||
}
|
}, contentTypeHeader);
|
||||||
return {
|
return {
|
||||||
url: url.format(urlObj),
|
url: url.format(urlObj),
|
||||||
options: fetchOptions,
|
options: fetchOptions,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user