File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
templates/base/http-clients Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -106,8 +106,12 @@ export class HttpClient<SecurityDataType = unknown> {
106
106
[ContentType.Json]: (input:any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
107
107
[ContentType.JsonApi]: (input:any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
108
108
[ContentType.Text]: (input:any) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input,
109
- [ContentType.FormData]: (input: any) =>
110
- Object.keys(input || {}).reduce((formData, key) => {
109
+ [ContentType.FormData]: (input: any) => {
110
+ if (input instanceof FormData) {
111
+ return input;
112
+ }
113
+
114
+ return Object.keys(input || {}).reduce((formData, key) => {
111
115
const property = input[key];
112
116
formData.append(
113
117
key,
@@ -118,7 +122,8 @@ export class HttpClient<SecurityDataType = unknown> {
118
122
`${property}`
119
123
);
120
124
return formData;
121
- }, new FormData()),
125
+ }, new FormData());
126
+ },
122
127
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
123
128
}
124
129
You can’t perform that action at this time.
0 commit comments