forked from loafle/openapi-generator-original
Add last response code and headers (#3760)
* Add last response code and headers Apply same workaround as https://github.com/swagger-api/swagger-codegen/pull/1127 to typescript-angular2 template. * Add WithHttpInfo() methods to return raw response. * Revert change to http method formatting
This commit is contained in:
@@ -37,6 +37,25 @@ export class {{classname}} {
|
||||
{{#allParams}}* @param {{paramName}} {{description}}
|
||||
{{/allParams}}*/
|
||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
|
||||
return this.{{nickname}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#allParams}}* @param {{paramName}} {{description}}
|
||||
{{/allParams}}*/
|
||||
public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<Response> {
|
||||
const path = this.basePath + `{{path}}`;
|
||||
|
||||
let queryParameters = new URLSearchParams();
|
||||
@@ -105,14 +124,7 @@ export class {{classname}} {
|
||||
responseType: ResponseContentType.Json
|
||||
});
|
||||
|
||||
return this.http.request(path, requestOptions)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json();
|
||||
}
|
||||
});
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
||||
Reference in New Issue
Block a user