Skip to main content

getProfiles()

Get a list of all available browser profile labels.

Signature

Returns

Array of profile names that can be used with the browser option.

Example

Using a random profile


getOperatingSystems()

Get a list of all available operating systems for emulation.

Signature

Returns

Array of OS names that can be used with the os option.

Example

Combining browser and OS


resolveProfile()

Resolve a browser family alias to the concrete profile it points at.

Signature

Returns

The concrete profile. Concrete profiles pass through unchanged, so this is safe to call on any value accepted by the browser option.

Example

An alias resolves against the profile set shipped with your installed version of wreq-js, so the result moves when you upgrade. Log it when you need to know which fingerprint a given run actually used.

getEmulationHeaders()

Get the headers a browser profile injects into every request, without sending one.

Signature

Both arguments default to the same profile and OS as fetch.

Returns

A Headers instance holding the profile’s headers, in the profile’s own order and casing. Transport-level headers are not included: Host, Connection, Content-Length, and Accept-Encoding are added per request rather than by the emulation profile.

Example

Reusing a profile’s User-Agent

Passing a header through headers replaces the profile’s matching header and leaves the rest of the fingerprint intact, so read the value first when you want to build on it.

Headers

The Headers class for working with HTTP headers.

Constructor

Methods

  • append(name, value): add a header value
  • delete(name): remove a header
  • get(name): get a header value
  • has(name): check if header exists
  • set(name, value): set a header value
  • entries(): iterate over header entries
  • keys(): iterate over header names
  • values(): iterate over header values

Example


Response

The Response class representing HTTP responses.

Properties

  • status: HTTP status code
  • statusText: HTTP status text
  • headers: response headers
  • ok: true if status is 200-299
  • url: final URL after redirects
  • redirected: true if the response is the result of a redirect
  • body: ReadableStream<Uint8Array> or null
  • bodyUsed: true if body has been read
  • contentLength: content length from headers, or null
  • cookies: parsed response cookies as Record<string, string | string[]>

Methods

  • json(): parse body as JSON
  • text(): get body as string
  • arrayBuffer(): get body as ArrayBuffer
  • bytes(): get body as Uint8Array
  • blob(): get body as Blob
  • formData(): parse body as FormData
  • clone(): clone the response