Skip to content

Commit f39cb7f

Browse files
chore(internal/client): fix form-urlencoded requests
1 parent 0a075e0 commit f39cb7f

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
@@ -757,6 +757,14 @@ export class CasParser {
757757
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
758758
) {
759759
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
760+
} else if (
761+
typeof body === 'object' &&
762+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
763+
) {
764+
return {
765+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
766+
body: this.stringifyQuery(body as Record<string, unknown>),
767+
};
760768
} else {
761769
return this.#encoder({ body, headers });
762770
}

0 commit comments

Comments
 (0)