summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/web/body.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/cli/js/web/body.ts b/cli/js/web/body.ts
index 6e376de37..8f5b48ad8 100644
--- a/cli/js/web/body.ts
+++ b/cli/js/web/body.ts
@@ -25,6 +25,8 @@ function validateBodyType(owner: Body, bodySource: BodyInit | null): boolean {
return true;
} else if (bodySource instanceof FormData) {
return true;
+ } else if (bodySource instanceof URLSearchParams) {
+ return true;
} else if (!bodySource) {
return true; // null body is fine
}
@@ -193,7 +195,10 @@ export class Body implements domTypes.Body {
);
} else if (this._bodySource instanceof ReadableStreamImpl) {
return bufferFromStream(this._bodySource.getReader());
- } else if (this._bodySource instanceof FormData) {
+ } else if (
+ this._bodySource instanceof FormData ||
+ this._bodySource instanceof URLSearchParams
+ ) {
const enc = new TextEncoder();
return Promise.resolve(
enc.encode(this._bodySource.toString()).buffer as ArrayBuffer