Composable HTTP request library for node and browsers
HEALTH ? 96 / Healthy
Composable HTTP request library for node and browsers
// readme
Generic HTTP request library for Node.js (>= 22.12), browsers, Deno, Bun, and edge runtimes. It is built on fetch().
AbortSignal.timeout()AbortControllerHTTP_PROXY/HTTPS_PROXY from environment)fetch for testing and custom transportsnpm install get-it
import {createRequester} from 'get-it'
const request = createRequester({
base: 'https://api.example.com',
headers: {Authorization: 'Bearer ...'},
})
// Simple GET
const users = await request('/users')
console.log(users.json())
// POST with JSON body (auto-serialized)
const created = await request({
url: '/users',
method: 'POST',
body: {name: 'Espen'},
as: 'json',
})
console.log(created.body) // parsed JSON
Theβ¦