Skip to content

Commit cc9982c

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

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,14 @@ export class Kernel {
854854
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
855855
) {
856856
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
857+
} else if (
858+
typeof body === 'object' &&
859+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
860+
) {
861+
return {
862+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
863+
body: this.stringifyQuery(body as Record<string, unknown>),
864+
};
857865
} else {
858866
return this.#encoder({ body, headers });
859867
}

0 commit comments

Comments
 (0)