Skip to main content
This release is 1 version behind 1.4.0 — the latest version of @rj/http. Jump to latest

@rj/http@1.3.0
Built and signed on GitHub Actions

A flexible HTTP client for making requests with customizable options and a builder pattern for easy configuration.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 hours ago (1.3.0)

A simple and flexible HTTP client for making requests with customizable options. This module provides an easy-to-use interface for sending GET, POST, PUT, PATCH, and DELETE requests, along with a builder pattern for configuring the request.

The HttpClient class allows setting request parameters such as headers, body, timeout, credentials, and more. It supports various response types such as JSON, text, blobs, and streams. Additionally, it allows for advanced options like custom fetch implementations, cache control, and more.

Usage:

const client = new HttpClient({ baseUrl: 'https://jsonplaceholder.typicode.com' });

// Sending a GET request
const response = await client.get('todos', 1).json();

// Sending a POST request with JSON body
const response = await client.post('todos').body({ key: 'value' }).json();
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@rj/http

Import symbol

import * as http from "@rj/http";

---- OR ----

Import directly with a jsr specifier

import * as http from "jsr:@rj/http";

Add Package

npx jsr add @rj/http

Import symbol

import * as http from "@rj/http";

Add Package

yarn dlx jsr add @rj/http

Import symbol

import * as http from "@rj/http";

Add Package

pnpm dlx jsr add @rj/http

Import symbol

import * as http from "@rj/http";

Add Package

bunx jsr add @rj/http

Import symbol

import * as http from "@rj/http";