Requisition is a lightweight, fluent HTTP client designed specifically for Node.js, with a strong emphasis on ES6/ES7 `async/await` patterns. It provides a minimal API for making HTTP requests (GET, POST, etc.) and offers utilities for handling responses, such as parsing JSON, reading as text or buffer, and saving to a file. Unlike browser-compatible alternatives like Axios, Requisition focuses solely on the Node.js environment, foregoing large options objects in favor of a chainable, method-based interface. The package is currently at version 1.7.0, with its last update nearly seven years ago (June 2017), indicating it is no longer actively maintained and should be considered abandoned. Due to its age, it targets older Node.js versions and exclusively uses CommonJS modules.
npm install requisitionVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to make a GET request to fetch user data, parse a JSON response, handle different HTTP statuses, and conditionally save a related file to disk, all using `async/await` with `requisition`.
Use CommonJS `const req = require('requisition');` or consider migrating to a modern HTTP client that supports ESM like `node-fetch` or `axios`.Avoid using in new projects. For existing projects, consider a migration plan to a actively maintained HTTP client to ensure security, performance, and compatibility with current Node.js ecosystems.
Explicitly use `try...catch` for all `await` expressions to gracefully handle network errors, timeouts, and HTTP response errors. Ensure you consume response bodies (e.g., `await res.json()`, `res.dump()`) even on error to prevent resource leaks.
Thoroughly test cookie handling to ensure compatibility with your target server. For more advanced cookie management, consider external libraries or manual header manipulation if `.cookie()` doesn't meet needs.
Change `import req from 'requisition';` to `const req = require('requisition');`.Ensure your bundler is configured to correctly handle CommonJS modules, or preferably, use `require('requisition')` if possible. Best to migrate to a modern, ESM-compatible HTTP client.Increase the request timeout using `.timeout(ms)` or investigate server-side logs for the remote service. Check for network connectivity or proxy configuration issues. Ensure the server is not closing the connection due to malformed requests.
Verify that the target server is running and accessible at the specified URL and port. Check firewall settings on both client and server machines.
No dependency data recorded yet.