Skip to main content
Make HTTP requests via the mobile device, useful for API calls that need to appear from a mobile IP address or with mobile-specific headers.

Method

page.request()

Performs an HTTP request through the device’s network connection.
Parameters:
  • url: URL to make the request to
  • options (optional): Request options
Options:
Returns: Result object with:
  • value(options?): Promise that resolves to response data
  • stream: Internal stream object
  • readable: ReadableStream<Uint8Array> for streaming response body
  • bytes(): Promise that consumes stream and returns Uint8Array
  • json(): Promise that consumes stream and returns parsed JSON
  • close(): Close the stream
Examples:

Complete examples

API calls with mobile headers

POST data to API

Authenticated API requests

Download file

Streaming response

Get response as bytes

Get response as JSON

Upload file

GraphQL query

Retry failed requests

Paginated API requests

Check API availability

Best practices

Always set timeouts for requests to avoid hanging:
Call value({ close: true }) to properly close the response:
Wrap requests in try-catch blocks:
Include appropriate headers for mobile API endpoints:

Waiting

Wait for specific requests

Events

Monitor XHR/fetch requests

Cookies

Manage request cookies

Page overview

Back to Page API overview