Skip to content

Commit ef09701

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

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
@@ -732,6 +732,14 @@ export class ScanDocuments {
732732
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
733733
) {
734734
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
735+
} else if (
736+
typeof body === 'object' &&
737+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
738+
) {
739+
return {
740+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
741+
body: this.stringifyQuery(body as Record<string, unknown>),
742+
};
735743
} else {
736744
return this.#encoder({ body, headers });
737745
}

0 commit comments

Comments
 (0)