WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
/ http Public

Type-safe, minimal, and flexible HTTP client with built-in timeout, delay, and Next.js caching support.

License

Notifications You must be signed in to change notification settings

dep-ts/http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dep/http 🌐

Type-safe, minimal, and flexible HTTP client with built-in timeout, delay, and Next.js caching support.

JSR version

Features ✨

  • ⚡ 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

Installation 📦

  • 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';

Usage 🎯

CLI 💻

http https://api.example.com/data --method GET --timeout 5000
http 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

API 🧩

Basic GET

import { get } from '@dep/http';

const response = await get('https://api.example.com/users');
const data = await response.json();
console.log(data);

POST with JSON Body

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 }),
});

Using http directly

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 }),
});

License 📄

MIT License – see LICENSE for details.

Author: Estarlin R (estarlincito.com)

About

Type-safe, minimal, and flexible HTTP client with built-in timeout, delay, and Next.js caching support.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published