Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-proxy-middleware

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-proxy-middleware - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

dist/handlers/fix-request-body.d.ts

5

CHANGELOG.md
# Changelog
## [v1.3.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.3.0)
- docs(response interceptor): align with nodejs default utf8 ([#567](https://github.com/chimurai/http-proxy-middleware/pull/567))
- feat: try to proxy body even after body-parser middleware ([#492](https://github.com/chimurai/http-proxy-middleware/pull/492)) ([midgleyc](https://github.com/midgleyc))
## [v1.2.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.2.1)

@@ -4,0 +9,0 @@

1

dist/handlers/public.d.ts
export { responseInterceptor } from './response-interceptor';
export { fixRequestBody } from './fix-request-body';

4

dist/handlers/public.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.responseInterceptor = void 0;
exports.fixRequestBody = exports.responseInterceptor = void 0;
var response_interceptor_1 = require("./response-interceptor");
Object.defineProperty(exports, "responseInterceptor", { enumerable: true, get: function () { return response_interceptor_1.responseInterceptor; } });
var fix_request_body_1 = require("./fix-request-body");
Object.defineProperty(exports, "fixRequestBody", { enumerable: true, get: function () { return fix_request_body_1.fixRequestBody; } });
{
"name": "http-proxy-middleware",
"version": "1.2.1",
"version": "1.3.0",
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync",

@@ -18,2 +18,3 @@ "main": "dist/index.js",

"prettier:fix": "prettier --write \"**/*.{js,ts,md,yml,json,html}\"",
"prebuild": "yarn clean",
"build": "tsc",

@@ -23,3 +24,3 @@ "pretest": "yarn build",

"coverage": "jest --coverage --coverageReporters=lcov",
"prepare": "yarn clean && yarn build && rm dist/tsconfig.tsbuildinfo"
"prepare": "yarn build && rm dist/tsconfig.tsbuildinfo"
},

@@ -65,2 +66,3 @@ "repository": {

"@typescript-eslint/parser": "^4.19.0",
"body-parser": "^1.19.0",
"browser-sync": "^2.26.14",

@@ -67,0 +69,0 @@ "connect": "^3.7.0",

@@ -72,2 +72,3 @@ # http-proxy-middleware

- [External WebSocket upgrade](#external-websocket-upgrade)
- [Intercept and manipulate requests](#intercept-and-manipulate-requests)
- [Intercept and manipulate responses](#intercept-and-manipulate-responses)

@@ -486,2 +487,21 @@ - [Working examples](#working-examples)

## Intercept and manipulate requests
Intercept requests from downstream by defining `onProxyReq` in `createProxyMiddleware`.
Currently the only pre-provided request interceptor is `fixRequestBody`, which is used to fix proxied POST requests when `bodyParser` is applied before this middleware.
Example:
```javascript
const { createProxyMiddleware, fixRequestBody } = require('http-proxy-middleware');
const proxy = createProxyMiddleware({
/**
* Fix bodyParser
**/
onProxyReq: fixRequestBody,
});
```
## Intercept and manipulate responses

@@ -512,3 +532,3 @@

onProxyRes: responseInterceptor(async (responseBuffer, proxyRes, req, res) => {
const response = responseBuffer.toString('utf-8'); // convert buffer to string
const response = responseBuffer.toString('utf8'); // convert buffer to string
return response.replace('Hello', 'Goodbye'); // manipulate response and return the result

@@ -515,0 +535,0 @@ }),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc