Type-safe, minimal, and flexible HTTP client with built-in timeout, delay, and Next.js caching support.
- ⚡ Simple and type-safe HTTP wrapper for
fetch - ⏱️ Timeout and delay support for better request control
- 🧠 Full TypeScript types for headers and HTTP methods
- 🧩 Works seamlessly with Next.js caching (
next.revalidate,next.tags) - 🖥️ Includes a lightweight CLI for quick requests from the terminal
-
Deno:
deno add jsr:@dep/http deno install -A -n http jsr:@dep/http/cli
-
Node.js (18+) or Browsers:
npx jsr add @dep/http
Then import as an ES module:
import { get, post, http } from '@dep/http';
http https://api.example.com/data --method GET --timeout 5000http https://api.example.com/users --method POST --body '{"name": "John"}'Options:
--method→ HTTP method (GET,POST,DELETE,PATCH)--headers→ JSON string of headers--body→ Request body data--timeout→ Timeout in milliseconds
import { get } from '@dep/http';
const response = await get('https://api.example.com/users');
const data = await response.json();
console.log(data);import { post } from '@dep/http';
const response = await post('https://api.example.com/users', {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'Estarlin', age: 24 }),
});import { http } from '@dep/http';
const res = await http('https://api.example.com/data', {
method: 'PATCH',
timeout: 8000,
headers: { Authorization: 'Bearer token' },
body: JSON.stringify({ active: true }),
});MIT License – see LICENSE for details.
Author: Estarlin R (estarlincito.com)