This site counts visits with analytics cookies only if you accept. Read the consent

Skip to content

ExamplesRaw Data Mode

Raw Data Mode

Access full response metadata through .raw — status code, headers, and data in one object.

Normal Mode

Returns just the response data.

ts
// Default — returns just the data
const users = await caller.users.getAll()
// → { data: [...], total: 3 }
caller.users.getAll()SANDBOX
idle
// run the request to see the response

Requests

as the browser recorded them and the site's server told of them

// no request yet: run the call

Raw Data Mode

Returns status, headers, and data. The headers are the API's, as the site's proxy route passed them on: its request below names those the API answered with and those the route answered the browser with, so you see which went through and which stayed behind — a connection's own, as keep-alive.

ts
// .raw accessor — returns { status, headers, data }
const response = await caller.users.raw.getAll()

// response.status  → 200
// response.headers → Headers { etag, vary, … }: those that describe the answer
// response.data    → { data: [...], total: 3 }
caller.users.raw.getAll()SANDBOX
idle
// run the request to see the response

Requests

as the browser recorded them and the site's server told of them

// no request yet: run the call

Raw data docs

Type Safety

TypeScript follows the accessor: .raw types the call as an HttpResponse.

ts
// The .raw accessor changes what the call is typed to return
const data = await caller.users.getAll()
//    ^? { data: User[]; total: number }

const response = await caller.users.raw.getAll()
//    ^? HttpResponse<{ data: User[]; total: number }>
//       { status: number; headers: Headers; data: … }

With the .raw accessor, the return type wraps data in an HttpResponse object with status and headers. Without it, you get the data directly.