A Node.js HTTP client that wraps the request library with Bluebird promises, automatically rejecting on HTTP error status codes (>= 400). Version 2.0.1 is the latest stable release (last updated 2016). The package is deprecated in favor of using modern HTTP clients like `node-fetch` or `axios` with native promises. Key differentiators: built-in HTTP error classes for specific status codes (e.g., `NotFoundError`, `InternalServerError`) and automatic rejection on non-2xx responses.
npm install http-as-promisedVerified import paths — ran on the pinned version, not inferred.
Shows basic GET request with spread to access response and body, and catch for HTTP errors.
Use axios, node-fetch, or got instead
Update to Node >=10 or use alternative HTTP client
Use .spread() or set resolve option to 'body' if you only want the body
Set error: false in options to handle 4xx/5xx responses yourself
Use a different HTTP client
Run `npm install http-as-promised` and use `require('http-as-promised')`Ensure you call $http() and not use it as a static object
Add .catch() or use try/catch with async/await