Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript-fetch: nullify url search #12330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading