From c2780abd70a3519c40da1ab21bd7de6ce7ed2188 Mon Sep 17 00:00:00 2001 From: Maciej Date: Tue, 1 Nov 2016 05:02:40 -0400 Subject: [PATCH] fixing issue#4037 - ts ng2 response type is always json (#4060) * fixing issue#4037 - default response is always json * updated documentation for new method * updated comment for new method --- .../typescript-angular2/api.mustache | 23 ++++- .../typescript-angular2/default/api/PetApi.ts | 89 ++++++++++++++----- .../default/api/StoreApi.ts | 47 ++++++++-- .../default/api/UserApi.ts | 79 ++++++++++++---- .../typescript-angular2/npm/README.md | 4 +- .../typescript-angular2/npm/api/PetApi.ts | 89 ++++++++++++++----- .../typescript-angular2/npm/api/StoreApi.ts | 47 ++++++++-- .../typescript-angular2/npm/api/UserApi.ts | 79 ++++++++++++---- .../typescript-angular2/npm/package.json | 2 +- 9 files changed, 364 insertions(+), 95 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache index 6980d8f782..00a013f567 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -34,6 +34,21 @@ export class {{classname}} { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } {{#operation}} /** @@ -157,9 +172,13 @@ export class {{classname}} { {{#hasFormParams}} body: formParams.toString(), {{/hasFormParams}} - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts index 492423eb3f..f91faccdd6 100644 --- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts @@ -51,6 +51,21 @@ export class PetApi { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } /** * Add a new pet to the store @@ -225,9 +240,13 @@ export class PetApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -272,9 +291,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -317,9 +340,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -362,9 +389,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -395,17 +426,17 @@ export class PetApi { 'application/xml' ]; - // authentication (api_key) required - if (this.configuration.apiKey) - { - headers.set('api_key', this.configuration.apiKey); - } // authentication (petstore_auth) required // oauth required if (this.configuration.accessToken) { headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); } + // authentication (api_key) required + if (this.configuration.apiKey) + { + headers.set('api_key', this.configuration.apiKey); + } @@ -413,9 +444,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -459,9 +494,13 @@ export class PetApi { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -518,9 +557,13 @@ export class PetApi { method: RequestMethod.Post, headers: headers, body: formParams.toString(), - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -577,9 +620,13 @@ export class PetApi { method: RequestMethod.Post, headers: headers, body: formParams.toString(), - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts index 38d6741180..e5382d97b0 100644 --- a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts @@ -51,6 +51,21 @@ export class StoreApi { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } /** * Delete purchase order by ID @@ -149,9 +164,13 @@ export class StoreApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -189,9 +208,13 @@ export class StoreApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -229,9 +252,13 @@ export class StoreApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -267,9 +294,13 @@ export class StoreApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts index 9ba9abd407..a3f14b2379 100644 --- a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts @@ -51,6 +51,21 @@ export class UserApi { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } /** * Create user @@ -213,9 +228,13 @@ export class UserApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -251,9 +270,13 @@ export class UserApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -289,9 +312,13 @@ export class UserApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -329,9 +356,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -369,9 +400,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -412,9 +447,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -447,9 +486,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -490,9 +533,13 @@ export class UserApi { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index 6fb4d320d5..d5d17b9074 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201609212006 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201610271623 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201609212006 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201610271623 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts index 492423eb3f..f91faccdd6 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts @@ -51,6 +51,21 @@ export class PetApi { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } /** * Add a new pet to the store @@ -225,9 +240,13 @@ export class PetApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -272,9 +291,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -317,9 +340,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -362,9 +389,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -395,17 +426,17 @@ export class PetApi { 'application/xml' ]; - // authentication (api_key) required - if (this.configuration.apiKey) - { - headers.set('api_key', this.configuration.apiKey); - } // authentication (petstore_auth) required // oauth required if (this.configuration.accessToken) { headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); } + // authentication (api_key) required + if (this.configuration.apiKey) + { + headers.set('api_key', this.configuration.apiKey); + } @@ -413,9 +444,13 @@ export class PetApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -459,9 +494,13 @@ export class PetApi { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -518,9 +557,13 @@ export class PetApi { method: RequestMethod.Post, headers: headers, body: formParams.toString(), - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -577,9 +620,13 @@ export class PetApi { method: RequestMethod.Post, headers: headers, body: formParams.toString(), - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts index 38d6741180..e5382d97b0 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts @@ -51,6 +51,21 @@ export class StoreApi { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } /** * Delete purchase order by ID @@ -149,9 +164,13 @@ export class StoreApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -189,9 +208,13 @@ export class StoreApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -229,9 +252,13 @@ export class StoreApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -267,9 +294,13 @@ export class StoreApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts index 9ba9abd407..a3f14b2379 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts @@ -51,6 +51,21 @@ export class UserApi { this.configuration = configuration; } } + + /** + * + * Extends object by coping non-existing properties. + * @param objA object to be extended + * @param objB source object + */ + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } /** * Create user @@ -213,9 +228,13 @@ export class UserApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -251,9 +270,13 @@ export class UserApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -289,9 +312,13 @@ export class UserApi { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -329,9 +356,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -369,9 +400,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -412,9 +447,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -447,9 +486,13 @@ export class UserApi { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } @@ -490,9 +533,13 @@ export class UserApi { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters, - responseType: ResponseContentType.Json + search: queryParameters }); + + // https://github.com/swagger-api/swagger-codegen/issues/4037 + if (extraHttpRequestParams) { + requestOptions = this.extendObj(requestOptions, extraHttpRequestParams); + } return this.http.request(path, requestOptions); } diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index f5386456da..0bd97a1b43 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201609212006", + "version": "0.0.1-SNAPSHOT.201610271623", "description": "swagger client for @swagger/angular2-typescript-petstore", "author": "Swagger Codegen Contributors", "keywords": [