Simple wrapper for native NodeJS http[s].request providing a flexible interface for making HTTP/HTTPS requests. Stable version 1.0.2. Lightweight copy-paste reducer supporting various data types (plain objects, Buffer, ReadableStream), multipart file uploads, proxy requests, and automatic JSON parsing. Keeps access to native NodeJS http.ClientRequest events. Less feature-rich than axios or request but minimal and dependency-free.
npm install handy-httpVerified import paths — ran on the pinned version, not inferred.
Shows GET and POST requests with error handling using handy-http. Demonstrates simple URL string and options object usage.
Always check first argument for error before using response.
Always do: var client = new HTTPClient();
Set 'content-type' header explicitly when sending Buffer/Stream.
Explicitly set headers.content-type to 'multipart/form-data' when using files.
Use a more feature-rich library like 'request' or 'axios' for advanced proxy needs.
Use 'new HTTPClient()' or 'new (require('handy-http'))()'.Pass a callback function with two parameters: (err, res).
Ensure first argument is a string URL or options object, second is callback.
No dependency data recorded yet.