Function: fetch()
fetch(
input,init?):Promise<Response>
Defined in: src/http/fetch.ts:388
Fetch a resource, returning a standard global Response.
This mirrors the global Fetch API while exposing impers' impersonation and transport options via ImpersRequestInit.
- Network errors (connection/DNS/SSL/timeout/abort) are re-thrown as
TypeErrorwith the original impers exception preserved incause. - 4xx/5xx responses are returned (not rejected), matching Fetch semantics.
response.url/response.redirectedare not populated (constructor limit).
Parameters
input
string | URL | Request
A URL string, URL, or global Request.
init?
Standard RequestInit plus impers extensions.
Returns
Promise<Response>
A global Response.
Example
const res = await fetch("https://example.com", { impersonate: "chrome124" });
console.log(res.status, await res.text());