Understand how older Node.js codebases made HTTP requests before modern fetch-based libraries existed.
Migrate a legacy Node.js project away from request-promise to a maintained HTTP library.
Call a JSON API from Node.js with promise-based error handling in a legacy codebase that still uses this package.
Deprecated since February 2020, the underlying 'request' package is retired. Not recommended for new projects.
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.
← request on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.