Skip to content

Commit

Permalink
[typescript-angular] apply encodeURIComponent to path-parameter (#6525)
Browse files Browse the repository at this point in the history
* #6524: [typescript-angular] apply encodeURIComponent to path-parameter

* #6524: [typescript-angular2] update samples

* #6524: [typescript-angularjs] update samples
  • Loading branch information
macjohnny authored and wing328 committed Sep 23, 2017
1 parent 209158a commit 4a89d23
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,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 @@ -274,7 +274,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 @@ -437,7 +437,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 @@ -539,7 +539,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 @@ -615,7 +615,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 @@ -149,7 +149,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 @@ -231,7 +231,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 @@ -347,7 +347,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 @@ -389,7 +389,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 @@ -522,7 +522,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 @@ -274,7 +274,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 @@ -437,7 +437,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 @@ -539,7 +539,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 @@ -615,7 +615,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 @@ -149,7 +149,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 @@ -231,7 +231,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 @@ -347,7 +347,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 @@ -389,7 +389,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 @@ -522,7 +522,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 @@ -275,7 +275,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 @@ -438,7 +438,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 @@ -540,7 +540,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 @@ -616,7 +616,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 @@ -150,7 +150,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 @@ -232,7 +232,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 @@ -348,7 +348,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 @@ -390,7 +390,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 @@ -523,7 +523,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

0 comments on commit 4a89d23

Please sign in to comment.