request-compose is a lightweight, dependency-free HTTP client for Node.js, built around the paradigm of function composition. It empowers developers to construct highly customized HTTP request and response pipelines by chaining together small, single-purpose middleware functions. The library's core philosophy emphasizes zero external dependencies, minimal abstraction, and stateless operation, offering a flexible and performant foundation for various HTTP interaction patterns. Its current stable version is 2.1.7. While a specific release cadence is not explicitly defined, the package appears actively maintained given its npm version and GitHub activity. Key differentiators include its extreme modularity, functional programming approach, and a footprint that includes no external runtime dependencies, contrasting with more opinionated HTTP clients by providing granular control over every step of the request-response lifecycle without imposing a rigid structure.
npm install request-composeVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `request-compose` by creating a composed HTTP client, setting default headers, fetching user data from GitHub, and parsing the JSON response. This example leverages the bundled Request and Response middlewares.
For ESM, use `import compose from 'request-compose'; const { Request, Response } = compose;`. For CommonJS, use `const compose = require('request-compose'); const { Request, Response } = compose;`.Consult the 'Compose' section in the documentation for advanced examples illustrating how to integrate native `http`/`https` request logic into your custom composed client.
Always wrap calls to your composed functions in `try...catch` blocks or chain a `.catch()` handler to the returned promise.
Use `import compose from 'request-compose'; const { Request, Response } = compose;` (ESM) or `const compose = require('request-compose'); const { Request, Response } = compose;` (CommonJS).Use `import compose from 'request-compose';` (ESM) or `const compose = require('request-compose');` (CommonJS).Verify the URL, hostname, and port provided to `Request.url()` or within your custom request options. Ensure the target server is operational and network access is permitted.
For CommonJS environments, use `require()` syntax (e.g., `const compose = require('request-compose');`). For ESM in Node.js, ensure your `package.json` contains `"type": "module"` and use `import` statements.No dependency data recorded yet.