Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/api/class-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Request's post body in a binary form, if any.

## method: Request.postDataJSON
* langs: js, python
- returns: <[null]|[any]>
- returns: <[null]|[Serializable]>

Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.

Expand Down
2 changes: 1 addition & 1 deletion types/structs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { JSHandle, ElementHandle, Frame, Page, BrowserContext, Locator } from '.
/**
* Can be converted to JSON
*/
export type Serializable = {};
export type Serializable = any;
/**
* Can be converted to JSON, but may also contain JSHandles.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13420,7 +13420,7 @@ export interface Request {
* When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.
* Otherwise it will be parsed as JSON.
*/
postDataJSON(): null|any;
postDataJSON(): null|Serializable;

/**
* Request that was redirected by the server to this one, if any.
Expand Down
3 changes: 2 additions & 1 deletion utils/generate_types/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,11 @@ playwright.chromium.launch().then(async browser => {
(async () => {
const browser = await playwright.chromium.launch();
const page = await browser.newPage();
await Promise.all([
const [response] = await Promise.all([
page.waitForResponse(response => response.url().includes('example.com')),
page.goto('https://example.com')
]);
console.log((await response!.json()).foobar); // JSON return value should be any

await browser.close();
})();
Expand Down