diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.ts index 7aaa5069c2..87c31579b5 100644 --- a/packages/playwright-core/src/client/fetch.ts +++ b/packages/playwright-core/src/client/fetch.ts @@ -175,8 +175,12 @@ export class APIRequestContext extends ChannelOwner= 0, `'maxRedirects' must be greater than or equal to '0'`); assert(options.maxRetries === undefined || options.maxRetries >= 0, `'maxRetries' must be greater than or equal to '0'`); const url = options.url !== undefined ? options.url : options.request!.url(); - const params = mapParamsToArray(options.params); const method = options.method || options.request?.method(); + let encodedParams = undefined; + if (typeof options.params === 'string') + encodedParams = options.params; + else if (options.params instanceof URLSearchParams) + encodedParams = options.params.toString(); // Cannot call allHeaders() here as the request may be paused inside route handler. const headersObj = options.headers || options.request?.headers(); const headers = headersObj ? headersObjectToArray(headersObj) : undefined; @@ -228,7 +232,8 @@ export class APIRequestContext extends ChannelOwner