Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.19 KB

File metadata and controls

40 lines (26 loc) · 1.19 KB

request-modern

Fetch-backed migration client for code moving away from request.

request is deprecated. This package preserves the most common request-shaped call patterns while returning modern Response objects and typed result helpers.

Install

npm install request-modern

Usage

import request, { get, post } from "request-modern";

const response = await get("https://example.com");
const json = await request.json("https://api.example.com/data");

request("https://example.com", (error, response, body) => {
  if (error) throw error;
  console.log(response.statusCode, body);
});

API

  • request(urlOrOptions, callback?)
  • get(urlOrOptions, callback?)
  • post(urlOrOptions, callback?)
  • request.text(urlOrOptions)
  • request.json(urlOrOptions)

Migration Position

request-modern is an independent alternative or migration helper for projects moving away from request. It is not affiliated with the original package maintainers or project.

For release context, see the local migration guide, examples, compatibility notes, source metadata, and adoption plan.