@@ -14,9 +14,9 @@ module {{package}} {
14
14
export class { {classname} } {
15
15
private basePath = ' {{basePath}}' ;
16
16
17
- static $inject : string[] = [' $http' ];
17
+ static $inject : string[] = [' $http' , ' $httpParamSerializer ' ];
18
18
19
- constructor(private $http : ng.IHttpService, basePath?: string) {
19
+ constructor(private $http : ng.IHttpService, private $ httpParamSerializer : (any) = > any, basePath?: string) {
20
20
if (basePath) {
21
21
this.basePath = basePath;
22
22
}
@@ -32,7 +32,10 @@ module {{package}} {
32
32
{ {/pathParams} }
33
33
var queryParameters: any = { } ;
34
34
var headerParams: any = { } ;
35
+ { {#hasFormParams} }
36
+ var formParams: any = { } ;
35
37
38
+ { {/hasFormParams} }
36
39
{ {#allParams} }
37
40
{ {#required} }
38
41
// verify required parameter '{ {paramName} }' is set
@@ -52,12 +55,22 @@ module {{package}} {
52
55
headerParams['{ {baseName} }'] = { {paramName} };
53
56
54
57
{ {/headerParams} }
58
+ { {#hasFormParams} }
59
+ headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
60
+
61
+ { {/hasFormParams} }
62
+ { {#formParams} }
63
+ formParams['{ {baseName} }'] = { {paramName} };
64
+
65
+ { {/formParams} }
55
66
var httpRequestParams: any = {
56
67
method: ' {{httpMethod}}' ,
57
68
url: path,
58
- json: true ,
69
+ json: {{#hasFormParams } }false { {/hasFormParams } } { {^hasFormParams } } true{ {/hasFormParams } } ,
59
70
{ {#bodyParam} }data: { {paramName} },
60
71
{ {/bodyParam} }
72
+ { {#hasFormParams} }data: this.$httpParamSerializer(formParams),
73
+ { {/hasFormParams} }
61
74
params: queryParameters,
62
75
headers: headerParams
63
76
};
0 commit comments