Skip to content

Commit b31b940

Browse files
authored
Fix contentFormatter for FormData returning an empty FormData object
1 parent 5d4fe0d commit b31b940

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/base/http-clients/fetch-http-client.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ export class HttpClient<SecurityDataType = unknown> {
104104
private contentFormatters: Record<ContentType, (input: any) => any> = {
105105
[ContentType.Json]: (input:any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
106106
[ContentType.Text]: (input:any) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input,
107-
[ContentType.FormData]: (input: any) =>
108-
Object.keys(input || {}).reduce((formData, key) => {
109-
const property = input[key];
107+
[ContentType.FormData]: (input: FormData) =>
108+
(Array.from(input.keys()) || []).reduce((formData, key) => {
109+
const property = input.get(key);
110110
formData.append(
111111
key,
112112
property instanceof Blob ?

0 commit comments

Comments
 (0)