http-request-plus is a lightweight, promise-oriented, and stream-capable wrapper around Node.js's built-in `http` and `https` modules. Designed for Node.js environments (requiring `node >=14.18`), it offers a minimalistic API for making network requests, handling redirects, and processing responses as buffers, text, or JSON. The current stable version is 1.0.3, with updates appearing infrequently, suggesting a maintenance-focused cadence rather than active feature development. Its key differentiator is being a thin abstraction directly over native Node.js HTTP capabilities, providing fine-grained control and stream processing without the overhead of more feature-rich alternatives like `axios` or `node-fetch`, while still offering promise-based convenience.
npm install http-request-plusVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to make a GET request, handle potential network errors or non-2xx status codes, and retrieve the response body as text. It includes basic error handling and an example of setting headers and a timeout.
To prevent throwing on non-2xx status codes, set the `bypassStatusCheck` option to `true` in the request configuration: `httpRequestPlus(url, { bypassStatusCheck: true })`.Always wrap `httpRequestPlus` calls in a `try...catch` block or chain a `.catch()` method to handle initial request errors. For stream-related errors, attach an `'error'` event listener to the `response` object: `response.on('error', (err) => console.error('Response stream error:', err));`No direct fix for consumers, but be aware when contributing or referencing repository branches.
Double-check the URL for typos. Ensure your network connection is active and that the DNS server can resolve the domain.
Increase the `timeout` option in the request configuration if the server is slow to respond, or ensure your `AbortSignal` logic is correct and not prematurely aborting requests. Check server logs for long processing times.
Ensure you `await` the `httpRequestPlus` call: `const response = await httpRequestPlus(url);`.
If you want to handle 4xx/5xx status codes without throwing, set `bypassStatusCheck: true` in your request options: `httpRequestPlus(url, { bypassStatusCheck: true })`. Then, manually check `response.statusCode`.No dependency data recorded yet.