Supertest with Proxy Support

5.0.2 · abandoned · verified Wed Apr 22

supertest-with-proxy is a specialized wrapper around the popular `supertest` library, designed to facilitate testing HTTP servers that require proxy configurations. It extends `supertest`'s capabilities by enabling the specification of an HTTP proxy for test requests, a common requirement in enterprise or complex network environments. The current stable version is 5.0.2. This package appears to be abandoned, with its last publish occurring over six years ago, meaning there are no active releases or maintenance, and its compatibility with modern Node.js or `supertest` versions is uncertain. Its key differentiator was providing direct proxy integration, which standard `supertest` does not offer out-of-the-box, simplifying testing for proxy-aware applications with a familiar, chainable API.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to use `supertest-with-proxy` to test an Express.js application's `/user` endpoint, routing the request through a specified proxy server and asserting the response.

const request = require('supertest-with-proxy');
const express = require('express');

const app = express();

app.get('/user', function(req, res) {
  res.status(200).json({ name: 'john' });
});

request(app)
  .get('/user')
  .proxy('http://example.com')
  .expect('Content-Type', /json/)
  .expect('Content-Length', '15')
  .expect(200)
  .end(function(err, res) {
    if (err) throw err;
    console.log('Test passed for user endpoint with proxy.');
  });

view raw JSON →