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-angular] apply encodeURIComponent to path-parameter #6525

Merged
merged 3 commits into from
Sep 23, 2017
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 @@ -117,7 +117,7 @@ export class {{classname}} {
{{/allParams}}*/
public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('${' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
.replace('${' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class {{classname}} {
{{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};

let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class PetService {
*/
public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -416,7 +416,7 @@ export class PetService {
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -510,7 +510,7 @@ export class PetService {
*/
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -577,7 +577,7 @@ export class PetService {
*/
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}/uploadImage'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class StoreService {
*/
public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
.replace('${' + 'orderId' + '}', encodeURIComponent(String(orderId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -218,7 +218,7 @@ export class StoreService {
*/
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
.replace('${' + 'orderId' + '}', encodeURIComponent(String(orderId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class UserService {
*/
public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -368,7 +368,7 @@ export class UserService {
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -489,7 +489,7 @@ export class UserService {
*/
public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class PetService {
*/
public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -416,7 +416,7 @@ export class PetService {
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -510,7 +510,7 @@ export class PetService {
*/
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -577,7 +577,7 @@ export class PetService {
*/
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}/uploadImage'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class StoreService {
*/
public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
.replace('${' + 'orderId' + '}', encodeURIComponent(String(orderId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -218,7 +218,7 @@ export class StoreService {
*/
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
.replace('${' + 'orderId' + '}', encodeURIComponent(String(orderId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class UserService {
*/
public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -368,7 +368,7 @@ export class UserService {
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -489,7 +489,7 @@ export class UserService {
*/
public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class PetService implements PetServiceInterface {
*/
public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -417,7 +417,7 @@ export class PetService implements PetServiceInterface {
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -511,7 +511,7 @@ export class PetService implements PetServiceInterface {
*/
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -578,7 +578,7 @@ export class PetService implements PetServiceInterface {
*/
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}/uploadImage'
.replace('${' + 'petId' + '}', String(petId));
.replace('${' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class StoreService implements StoreServiceInterface {
*/
public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
.replace('${' + 'orderId' + '}', encodeURIComponent(String(orderId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -219,7 +219,7 @@ export class StoreService implements StoreServiceInterface {
*/
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
.replace('${' + 'orderId' + '}', encodeURIComponent(String(orderId)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class UserService implements UserServiceInterface {
*/
public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -369,7 +369,7 @@ export class UserService implements UserServiceInterface {
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down Expand Up @@ -490,7 +490,7 @@ export class UserService implements UserServiceInterface {
*/
public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
.replace('${' + 'username' + '}', encodeURIComponent(String(username)));

let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper());
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/typescript-angularjs/api/PetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class PetApi {
*/
public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
Expand Down Expand Up @@ -154,7 +154,7 @@ export class PetApi {
*/
public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Pet> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
Expand Down Expand Up @@ -212,7 +212,7 @@ export class PetApi {
*/
public updatePetWithForm (petId: number, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
Expand Down Expand Up @@ -251,7 +251,7 @@ export class PetApi {
*/
public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.ApiResponse> {
const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));

let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
Expand Down
Loading