Requests read like their intent
Write the request flow naturally from top to bottom, from the HTTP method through authentication, timeout, and response format.
.get<User>('/users/1')
.auth(token)
.timeout(3000)
.toJson()dench-fetch keeps the flexibility of the native Fetch API while organizing repetitive request options into short, type-safe chains.
const user = await api
.get<User>('/users/1')
.auth(token)
.timeout(3000)
.toJson();/users/1200dench-fetch is a TypeScript request builder built on the native Fetch API. Compose requests with short, readable chains instead of complex configuration objects, then execute them explicitly when needed.
const user = await api
.get<User>('/users/1')
.auth('access-token')
.timeout(3000)
.toJson();Write the request flow naturally from top to bottom, from the HTTP method through authentication, timeout, and response format.
.get<User>('/users/1')
.auth(token)
.timeout(3000)
.toJson()Building a request does not send it. The actual fetch runs only when you select the response format.
.toJson()
.toResponse()
.toFormData()Set JSON, FormData, Blob, URL-encoded data, or a raw body with a method designed for that format.
.sendJson(data)
.sendForm(form)
.sendBlob(blob)Copy a builder with authentication and timeout settings, then change only the API path to reduce repetition.
common.copy().api('/users')
common.copy().api('/posts')npm install dench-fetch