Package Exports
- hyperttp
- hyperttp/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hyperttp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Hyperttp
Advanced HTTP client for Node.js with caching, rate limiting, request queuing, automatic retries, cookie management, and automatic JSON/XML parsing.
Features
- Automatic request deduplication
- LRU caching with TTL
- Configurable rate limiting
- Concurrent request management
- Exponential backoff with jitter for retries
- Cookie jar support
- Automatic response parsing (JSON/XML/text/buffer)
- Automatic handling of redirects
- Fluent request builder API
Installation
npm install hyperttpBasic Usage
import HttpClientImproved from "hyperttp";
const client = new HttpClientImproved({
timeout: 10000,
maxConcurrent: 10,
logger: (level, msg) => console.log(`[${level}] ${msg}`),
});
// Simple GET request
const data = await client.get("https://api.example.com/data");
console.log(data);
// POST request with JSON body
const postData = await client.post("https://api.example.com/items", {
name: "Item 1",
});
console.log(postData);
// Using fluent RequestBuilder
const builderData = await client
.request("https://api.example.com/search")
.query({ q: "hyperttp", limit: 10 })
.headers({ Authorization: "Bearer TOKEN" })
.json()
.send();
console.log(builderData);Fluent Builder API
client
.request("https://api.example.com/data")
.get() // default
.headers({ "X-Test": "123" })
.query({ page: 1 })
.json() // or .text(), .xml()
.send()
.then(console.log);Advanced Features
Caching: Automatically caches GET/HEAD responses, configurable TTL and max size
Rate limiting: Prevents overwhelming servers
Retries: Automatic retries for 408, 429, 500, 502, 503, 504 with exponential backoff
Cookies: Persistent cookie jar per client
Metrics: Track request timings, bytes sent/received, retries, and cache hits