Skip to content

Commit

Permalink
Merge pull request #568 from cmalard/master
Browse files Browse the repository at this point in the history
fix(typescript-angular): correct httpClient call with URL query parameters & support body for all methods
  • Loading branch information
HugoMario authored Dec 27, 2019
2 parents d466104 + 7eb1e9c commit 4b74540
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,14 @@ export class {{classname}} {

{{/hasFormParams}}
{{#useHttpClient}}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#hasBodyParam}}
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/hasBodyParam}}
return this.httpClient.request{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}({{httpMethod}},`${this.basePath}{{{path}}}`,
{
{{#bodyParam}}
body: {{paramName}}
{{/bodyParam}}
{{#hasFormParams}}
body: convertFormParamsToString ? formParams.toString() : formParams
{{/hasFormParams}}
{{#hasQueryParams}}
params: queryParameters,
{{/hasQueryParams}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,14 @@ export class {{classname}} {

{{/hasFormParams}}
{{#useHttpClient}}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#hasBodyParam}}
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/hasBodyParam}}
return this.httpClient.request{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}({{httpMethod}},`${this.basePath}{{{path}}}`,
{
{{#bodyParam}}
body: {{paramName}}
{{/bodyParam}}
{{#hasFormParams}}
body: convertFormParamsToString ? formParams.toString() : formParams
{{/hasFormParams}}
{{#hasQueryParams}}
params: queryParameters,
{{/hasQueryParams}}
Expand Down

0 comments on commit 4b74540

Please sign in to comment.