Postman Request Client

2.88.1-postman.48 · active · verified Tue Apr 21

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.

Common errors

Warnings

Install

Imports

Quickstart

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
});

view raw JSON →