Skip to content

Commit 0cd835f

Browse files
Added resposne type supports for angular api
1 parent 41a7629 commit 0cd835f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/templates/angular2/api.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ export class {{groupName}}Service {
6565
}}{{
6666
#isFormRequest}}this.apiService.generateFormData(recursiveStringfy(requestBody)){{/isFormRequest
6767
}}{{/requestBodyType}},
68-
{{!
69-
// Remove "null" line and uncomment line below
70-
// if you want to set "content-type" on headers
71-
}}
72-
null,
73-
// { {{#requestContentType}} headers: { 'Content-Type': '{{{requestContentType}}}' } {{/requestContentType}} },
68+
{
69+
{{#requestContentType}}// headers: { 'Content-Type': '{{{requestContentType}}}' }{{/requestContentType}}
70+
responseType: '{{
71+
#isResponseTypeText}}text{{/isResponseTypeText
72+
}}{{#isResponseTypeJson}}json{{/isResponseTypeJson
73+
}}{{#isResponseTypeFile}}blob{{/isResponseTypeFile
74+
}}',
75+
},
7476
){{^isResponsePrimitive}}
7577
.pipe(
7678
map(response => recursiveInstance({{responseType}}, response))

0 commit comments

Comments
 (0)