Skip to content

Commit 1ac688c

Browse files
chore(internal/client): fix form-urlencoded requests
1 parent efb8e62 commit 1ac688c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,14 @@ export class Finch {
829829
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
830830
) {
831831
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
832+
} else if (
833+
typeof body === 'object' &&
834+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
835+
) {
836+
return {
837+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
838+
body: this.stringifyQuery(body as Record<string, unknown>),
839+
};
832840
} else {
833841
return this.#encoder({ body, headers });
834842
}

0 commit comments

Comments
 (0)