Registry / http-networking / httpreq

httpreq

JSON →
library0.0.1jsnpmunverified

httpreq is a Node.js library designed to simplify HTTP(S) requests. It offers a straightforward API for performing common HTTP methods, including GET, POST, PUT, PATCH, DELETE, and OPTIONS. Beyond basic requests, it supports features like file uploads, cookie management, custom headers, and basic authentication. A key distinguishing feature of httpreq is its `shuffleCiphers` option, which aims to help developers mitigate TLS fingerprinting – a technique used by some web services to identify and block automated scripts or non-browser clients based on their TLS handshake characteristics. The package is currently at version 1.1.1, with its last publication approximately two years ago, indicating a mature project in a maintenance phase with infrequent updates. It provides flexibility by supporting both traditional Node.js callback patterns and modern async/await syntax for handling responses, though it primarily operates within the CommonJS module system.

npm install httpreq
INSTALL
IMPORT
SIG · HTTPREQ
H
httpreq
http-networkingjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

httpreq
const httpreq = require('httpreq');
import httpreq from 'httpreq';
httpreq is a CommonJS module. Direct ES module `import` syntax is not natively supported for its main entry point without explicit loader configuration or transpilation.
get
const res = await httpreq.get('http://example.com');
httpreq.get('http://example.com').then(res => ...);
While `httpreq.get` supports an optional callback, for async/await usage, omit the callback and `await` the promise. Trying to use `.then()` directly on the callback-style call will not work as expected.
post
const res = await httpreq.post('http://example.com', { parameters: { key: 'value' } });
httpreq.post('http://example.com', { key: 'value' });
POST parameters must be nested under an `options.parameters` object, not directly as the second argument.

Demonstrates how to perform an asynchronous POST request with parameters, custom headers, and a timeout.

const httpreq = require('httpreq'); async function makePostRequest() { try { const res = await httpreq.post('http://posttestserver.com/post.php', { parameters: { name: 'John', lastname: 'Doe', api_key: process.env.API_KEY ?? '' // Example for sensitive data }, headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'node-httpreq-example' }, timeout: 5000 // 5 second timeout }); console.log('Status Code:', res.statusCode); console.log('Headers:', res.headers); console.log('Response Body:', res.body); console.log('Cookies:', res.cookies); } catch (err) { console.error('Request failed:', err); } } makePostRequest();
Debug
Known issues
gotchaTo avoid being identified and potentially blocked by anti-bot systems, consider using the `shuffleCiphers: true` option in your request options. Many services use TLS fingerprinting to detect non-browser clients.
fix
Add `shuffleCiphers: true` to your request options, e.g., `httpreq.get(url, { shuffleCiphers: true }, callback)`.
affects: >=1.0.0
gotchaThe package is in maintenance mode with infrequent updates (last published 2 years ago as of September 2023). While stable, new HTTP features or rapid bug fixes might not be integrated as quickly as in more actively developed alternatives like `got` or `axios`.
fix
Be aware of the project's maintenance status. For cutting-edge features or very active development, consider alternatives. For stable, proven use cases, it remains viable.
affects: >=1.1.1
gotchaWhen using the `proxy` option, ensure the `host`, `port`, and `protocol` are correctly configured. Misconfiguration can lead to `ECONNREFUSED` or `ETIMEDOUT` errors.
fix
Double-check proxy settings, including `host`, `port`, and `protocol` (default is 'http'). Ensure the proxy server is reachable and properly configured.
affects: >=1.0.0
gotchaWhen downloading files directly to disk using `httpreq.download()`, the progress callback (3rd parameter) prevents the use of `async/await` for the main request completion. You must use the traditional callback pattern for the final result.
fix
If a progress callback is provided, handle the final request completion using the 4th parameter (the callback function) instead of `awaiting` the function call.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'httpreq'
The package is not installed or the `require` path is incorrect.
fix
Run `npm install httpreq` to install the package.
Error: connect ECONNREFUSED 127.0.0.1:80
The request destination (server or proxy) refused the connection. This often indicates the server is down, inaccessible, or a firewall is blocking the connection.
fix
Verify the target URL or proxy settings, ensure the server is running, and check network connectivity or firewall rules. If using a proxy, ensure its host and port are correct.
Error: self-signed certificate in certificate chain
This typically occurs when making HTTPS requests to a server with an untrusted or self-signed SSL/TLS certificate, often in development environments or when an SSL-intercepting proxy is in use.
fix
For development or specific use cases, you can set `rejectUnauthorized: false` in the options, but be aware of security implications. For production, ensure valid certificates are used or trusted.
Error: read ETIMEDOUT
The server did not send a response within the configured timeout period, or the network connection timed out.
fix
Increase the `timeout` option in milliseconds or investigate network latency and server responsiveness. If a proxy is used, check its performance.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
httpreq — npm install httpreq · libregistry