Skip to content

Commit

Permalink
Fix OpenAPITools#5420 add headers from configuration object (OpenAPIT…
Browse files Browse the repository at this point in the history
…ools#5422)

* Fix OpenAPITools#5420 add headers from configuration object

* Add baseOptions undefined checking OpenAPITools#5420

* Update the samples and replace array to object OpenAPITools#5420

* Update sample
  • Loading branch information
nibytes authored and MikailBag committed Mar 23, 2020
1 parent 8467b5b commit dbce77c
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
{{#hasFormParams}}
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
{{/hasFormParams}}
Expand Down
60 changes: 40 additions & 20 deletions samples/client/petstore/typescript-axios/builds/default/api.ts

Large diffs are not rendered by default.

60 changes: 40 additions & 20 deletions samples/client/petstore/typescript-axios/builds/es6-target/api.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down Expand Up @@ -116,7 +117,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -163,7 +165,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -210,7 +213,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -253,7 +257,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -298,7 +303,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down Expand Up @@ -357,7 +363,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = localVarFormParams.toString();

return {
Expand Down Expand Up @@ -415,7 +422,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = localVarFormParams;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -91,7 +92,8 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -126,7 +128,8 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -162,7 +165,8 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down Expand Up @@ -93,7 +94,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down Expand Up @@ -131,7 +133,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down Expand Up @@ -168,7 +171,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -203,7 +207,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -250,7 +255,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -279,7 +285,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: globalImportUrl.format(localVarUrlObj),
Expand Down Expand Up @@ -321,7 +328,8 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");

Expand Down
Loading

0 comments on commit dbce77c

Please sign in to comment.