explaingit

request/request-promise

4,729JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A deprecated Node.js library that added Promise-based HTTP request handling on top of the 'request' package. No longer maintained, use modern alternatives for new projects.

Mindmap

mindmap
  root((request-promise))
    What it does
      HTTP requests Node.js
      Promise-based API
      Automatic error handling
    Status
      Deprecated 2020
      No new fixes
      Migrate away
    Features
      GET POST requests
      JSON API calls
      File uploads
    Alternatives
      Modern fetch
      axios
      got
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Understand how older Node.js codebases made HTTP requests before modern fetch-based libraries existed.

USE CASE 2

Migrate a legacy Node.js project away from request-promise to a maintained HTTP library.

USE CASE 3

Call a JSON API from Node.js with promise-based error handling in a legacy codebase that still uses this package.

Tech stack

JavaScriptNode.js

Getting it running

Difficulty · easy Time to first run · 30min

Deprecated since February 2020, the underlying 'request' package is retired. Not recommended for new projects.

In plain English

Request-Promise is a JavaScript library for making HTTP requests from Node.js applications. It wraps a widely-used package called request and adds support for a programming pattern called Promises, which lets you handle the results of web requests in a cleaner, more readable way than traditional callbacks. When a request returns an error code (anything outside the 200 range), the Promise is automatically rejected, making error handling more predictable. The README opens with a prominent deprecation warning. As of February 2020, the underlying request package was officially retired, and this wrapper was retired along with it. No new fixes or features are being developed. The README links to a discussion explaining the reasons behind that decision and lists alternative libraries that developers can migrate to. For anyone still encountering this package in older codebases, it supported all the standard request types: fetching web pages, calling JSON APIs, posting form data, uploading files, and sending cookies. Responses could be transformed before being passed along, and it was possible to configure whether non-2xx responses should be treated as errors or not. The README includes code examples for each of these cases. Two related packages are also mentioned for cases where using a specific Promise library matters. One relies on native JavaScript Promises instead of Bluebird, and another lets you plug in any compatible Promise library. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
I have a Node.js project using request-promise that I need to migrate to a modern library. Show me how to rewrite a basic GET request with native fetch or axios.
Prompt 2
My old Node.js app uses request-promise. What are my migration options and which one is closest to request-promise's API?
Prompt 3
How did request-promise handle non-2xx HTTP responses differently from callbacks, and how does that compare to fetch?
Prompt 4
Show me how request-promise handled posting JSON data and reading a JSON response, so I can replicate this in a modern library.
Open on GitHub → Explain another repo

← request on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.