gitmyhub

request-promise

JavaScript ★ 4.7k updated 2y ago

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

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.

JavaScriptNode.jssetup: easycomplexity 2/5

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.

Where it fits