{"id":13314,"library":"httpreq","title":"httpreq: Simplified HTTP(S) Client for Node.js","description":"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.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"git://github.com/SamDecrock/node-httpreq","tags":["javascript"],"install":[{"cmd":"npm install httpreq","lang":"bash","label":"npm"},{"cmd":"yarn add httpreq","lang":"bash","label":"yarn"},{"cmd":"pnpm add httpreq","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import httpreq from 'httpreq';","symbol":"httpreq","correct":"const httpreq = require('httpreq');"},{"note":"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.","wrong":"httpreq.get('http://example.com').then(res => ...);","symbol":"get","correct":"const res = await httpreq.get('http://example.com');"},{"note":"POST parameters must be nested under an `options.parameters` object, not directly as the second argument.","wrong":"httpreq.post('http://example.com', { key: 'value' });","symbol":"post","correct":"const res = await httpreq.post('http://example.com', { parameters: { key: 'value' } });"}],"quickstart":{"code":"const httpreq = require('httpreq');\n\nasync function makePostRequest() {\n  try {\n    const res = await httpreq.post('http://posttestserver.com/post.php', {\n      parameters: {\n        name: 'John',\n        lastname: 'Doe',\n        api_key: process.env.API_KEY ?? '' // Example for sensitive data\n      },\n      headers: {\n        'Content-Type': 'application/x-www-form-urlencoded',\n        'User-Agent': 'node-httpreq-example'\n      },\n      timeout: 5000 // 5 second timeout\n    });\n\n    console.log('Status Code:', res.statusCode);\n    console.log('Headers:', res.headers);\n    console.log('Response Body:', res.body);\n    console.log('Cookies:', res.cookies);\n  } catch (err) {\n    console.error('Request failed:', err);\n  }\n}\n\nmakePostRequest();","lang":"javascript","description":"Demonstrates how to perform an asynchronous POST request with parameters, custom headers, and a timeout."},"warnings":[{"fix":"Add `shuffleCiphers: true` to your request options, e.g., `httpreq.get(url, { shuffleCiphers: true }, callback)`.","message":"To 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The 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`.","severity":"gotcha","affected_versions":">=1.1.1"},{"fix":"Double-check proxy settings, including `host`, `port`, and `protocol` (default is 'http'). Ensure the proxy server is reachable and properly configured.","message":"When using the `proxy` option, ensure the `host`, `port`, and `protocol` are correctly configured. Misconfiguration can lead to `ECONNREFUSED` or `ETIMEDOUT` errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"When 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install httpreq` to install the package.","cause":"The package is not installed or the `require` path is incorrect.","error":"Error: Cannot find module 'httpreq'"},{"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.","cause":"The request destination (server or proxy) refused the connection. This often indicates the server is down, inaccessible, or a firewall is blocking the connection.","error":"Error: connect ECONNREFUSED 127.0.0.1:80"},{"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.","cause":"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.","error":"Error: self-signed certificate in certificate chain"},{"fix":"Increase the `timeout` option in milliseconds or investigate network latency and server responsiveness. If a proxy is used, check its performance.","cause":"The server did not send a response within the configured timeout period, or the network connection timed out.","error":"Error: read ETIMEDOUT"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}