Node.js Client HTTP/HTTPS Request Wrapper

0.0.7 · abandoned · verified Wed Apr 22

The `client-http` package, at its final release version 0.0.7, provided a simplified API for making HTTP/HTTPS requests in Node.js. Its core features included automatic proxy detection via the `http_proxy` environment variable, manual proxy configuration, basic cookie management, and automatic handling of HTTP 301/302 redirects. It also allowed for custom request headers and timeout settings. Development ceased due to the existence of the more comprehensive 'request' library, and the project is explicitly marked as abandoned by its maintainer. The library's `engines` configuration strictly targets very old Node.js versions (`>=0.6.11 <=0.7.0 || >=0.7.3`), making it fundamentally incompatible with modern Node.js runtimes and entirely unsuitable for current development due to severe security vulnerabilities and lack of maintenance. There is no ongoing release cadence.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates making basic HTTP GET requests to Google and Example.com, logging response data and showing how to set a global timeout.

const http = require('client-http');

// Make a simple HTTP GET request to Google
http.get("http://www.google.com/", function(data, err, cookie, headers){
    if (err) {
        console.error("Error:", err);
        return;
    }
    console.log("Response Data (truncated):");
    console.log(data ? data.substring(0, 200) + '...' : '[No Data]');
    console.log("Headers:", headers);
});

// Example of setting a timeout
http.setTimeout(5000); // Set timeout to 5 seconds
http.get("https://www.example.com/", function(data, err){
    if (err) {
        console.error("Timeout Error or other issue:", err);
        return;
    }
    console.log("Example.com response received within 5s.");
});

view raw JSON →