Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
Revert "feat(fetch/network): add generic to json method" (#34098)
Pavel Feldmanec1d3313c379
diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.tsindex 2cfbbff14b..58928532ac 100644--- a/packages/playwright-core/src/client/fetch.ts+++ b/packages/playwright-core/src/client/fetch.ts@@ -350,9 +350,9 @@ export class APIResponse implements api.APIResponse {return content.toString('utf8');}- async json<T = object>(): Promise<T> {+ async json(): Promise<object> {const content = await this.text();- return JSON.parse(content) as T;+ return JSON.parse(content);}async [Symbol.asyncDispose]() {diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.tsindex 25007db199..cb18681ccf 100644--- a/packages/playwright-core/src/client/network.ts+++ b/packages/playwright-core/src/client/network.ts@@ -718,9 +718,9 @@ export class Response extends ChannelOwner<channels.ResponseChannel> implementsreturn content.toString('utf8');}- async json<T = object>(): Promise<T> {+ async json(): Promise<object> {const content = await this.text();- return JSON.parse(content) as T;+ return JSON.parse(content);}request(): Request {