Registry / http-networking / postman-request

postman-request

JSON →
library2.88.1-postman.48jsnpmunverified

Postman-request is a maintained fork of the popular, now-abandoned `request` module, specifically developed and used internally by Postman Runtime. Currently at version 2.88.1-postman.48, it does not follow a typical open-source release cadence but is updated as needed for Postman's internal applications. This package provides a simplified API for making HTTP requests, addressing numerous long-standing bugs and adding specific features that were never incorporated into the original `request` project. Key differentiators include fixes for old-style deflate responses, correct URL parameter encoding, enhanced redirect behaviors (especially for 307/308 with Host headers), `content-length` for streaming, improved form-data exception handling, and features like retaining authorization headers on cross-domain redirects and support for extending root CA certificates. It aims to offer a stable and patched alternative for projects still reliant on the `request` API.

npm install postman-request
INSTALL
IMPORT
SIG · POSTMAN-REQUEST
P
postman-request
http-networkingjavascriptv2.88.1-postman.48
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

request
const request = require('postman-request');
import request from 'postman-request';
Primarily designed for CommonJS; direct ESM import might require specific configuration or a build step, as shown in the quickstart and examples.
request.post
const request = require('postman-request'); request.post('http://example.com/upload', { form: { key: 'value' } }, (error, response, body) => { /* ... */ });
import { post } from 'postman-request';
Convenience methods like `post` are accessed directly from the main `request` object, not as named exports.
request.defaults
const request = require('postman-request'); const defaultRequest = request.defaults({ headers: { 'User-Agent': 'my-app' } });
const defaultRequest = require('postman-request').defaults;
`defaults` is a method on the `request` function, used to create a new `request` instance with pre-set options.

Demonstrates a basic GET request to Google, logging the error, status code, and response body length.

const request = require('postman-request'); request('http://www.google.com', function (error, response, body) { if (error) { console.error('Error:', error); return; } console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received console.log('body length:', body ? body.length : 0); // Print the length of the Google homepage HTML });
Debug
Known issues
breakingOriginal 'request' module is abandoned; 'postman-request' is a fork with bug fixes. While largely compatible, subtle behavioral differences might affect existing code.
fix
Review existing `request` calls against `postman-request`'s specific bug fixes and added features. Test thoroughly to ensure compatibility, especially for edge cases in HTTP handling.
affects: *
gotchaLegacy API and CommonJS-first design. The underlying `request` API is considered legacy compared to `node-fetch` or `axios`.
fix
Prefer `require()` for consistency. If strict ESM is needed, investigate dynamic `import()` or build tool configurations. For new projects, consider modern Promise-based HTTP clients like `axios` or `node-fetch`.
affects: *
gotchaStream error handling requires specific placement. When chaining streams, an `error` event listener must be attached *before* piping.
fix
Attach `.on('error', handler)` directly to the `request` call before any `.pipe()` operations to ensure proper error capture for upstream failures.
affects: *
gotchaNot a general-purpose HTTP client for new projects. While actively maintained by Postman, its primary purpose is internal Postman Runtime needs.
fix
For new application development not specifically tied to the original `request` API, modern HTTP clients (e.g., `node-fetch`, `axios`) offer more contemporary APIs and features.
affects: *
gotchaSSL/TLS certificate validation issues can occur. Misconfigured environments or self-signed certificates might lead to errors like 'self signed certificate'.
fix
Ensure environments have up-to-date root CA certificates. For custom CAs, use the `ca` option to provide trusted certificates. Avoid disabling SSL validation (`strictSSL: false` or `rejectUnauthorized: false`) in production due to security risks.
affects: *
Errors
Common errors & fixes
Error: self signed certificate in certificate chain
The server's SSL certificate is self-signed or not trusted by the client's CA store.
fix
Ensure your system's root CA certificates are up-to-date. For private/self-signed CAs, pass the certificate authority via the `ca` option in the request configuration. Avoid `strictSSL: false` for security.
TypeError: request is not a function
Incorrect import statement, often when trying to use ESM `import` syntax with a CommonJS module, or destructuring incorrectly.
fix
Use `const request = require('postman-request');` for CommonJS environments, which is the module's primary export pattern.
Callback was already called.
A callback function was invoked multiple times, usually due to an internal error handling path or a malformed server response triggering a secondary error after the initial callback.
fix
Ensure your callback function only handles a single invocation. While `postman-request` aims to fix common `request` issues, robust error handling with flags can prevent double invocation: `let called = false; if (!called) { called = true; /* ...handle response... */ }`
Upgrade
Version history
2.88.1-postman.48latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
postman-request — npm install postman-request · libregistry