Skip to content

Commit

Permalink
Merge pull request #12330 from simeonborko/typescript-fetch-nullify-u…
Browse files Browse the repository at this point in the history
…rl-search

typescript-fetch: nullify url search
  • Loading branch information
HugoMario authored Feb 10, 2024
2 parents cff2c41 + 492a075 commit 7242d20
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class BaseAPI {
this.basePath = configuration.basePath || this.basePath;
}
}
};
}

/**
*
Expand Down Expand Up @@ -224,7 +224,7 @@ export const {{classname}}FetchParamCreator = function (configuration?: Configur
{{/bodyParam}}
localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
{{#hasFormParams}}
localVarRequestOptions.body = localVarFormParams.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.0-SNAPSHOT
2.4.40-SNAPSHOT
14 changes: 7 additions & 7 deletions samples/client/petstore-security-test/typescript-fetch/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface FetchAPI {
}

/**
*
*
* @export
* @interface FetchArgs
*/
Expand All @@ -50,29 +50,29 @@ export interface FetchArgs {
}

/**
*
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration?: Configuration;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
}

/**
*
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name = "RequiredError"
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down Expand Up @@ -122,7 +122,7 @@ export const FakeApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
localVarRequestOptions.body = localVarFormParams.toString();

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.19-SNAPSHOT
2.4.40-SNAPSHOT
46 changes: 23 additions & 23 deletions samples/client/petstore/typescript-fetch/builds/default/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as url from "url";
import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

const BASE_PATH = "https://petstore.swagger.io/v2".replace(/\/+$/, "");
const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");

/**
*
Expand Down Expand Up @@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration?: Configuration;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
Expand All @@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name = "RequiredError"
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down Expand Up @@ -386,7 +386,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down Expand Up @@ -431,7 +431,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -472,7 +472,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -513,7 +513,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -550,7 +550,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -589,7 +589,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down Expand Up @@ -642,7 +642,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
localVarRequestOptions.body = localVarFormParams.toString();

Expand Down Expand Up @@ -694,7 +694,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
localVarRequestOptions.body = localVarFormParams.toString();

Expand Down Expand Up @@ -1103,7 +1103,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -1134,7 +1134,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -1163,7 +1163,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -1193,7 +1193,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down Expand Up @@ -1422,7 +1422,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down Expand Up @@ -1454,7 +1454,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down Expand Up @@ -1486,7 +1486,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down Expand Up @@ -1517,7 +1517,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -1546,7 +1546,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -1587,7 +1587,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand All @@ -1610,7 +1610,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
Expand Down Expand Up @@ -1646,7 +1646,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarUrlObj.search = null;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
Expand Down

0 comments on commit 7242d20

Please sign in to comment.