express-http-proxy
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "express-http-proxy", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "http proxy middleware for express", | ||
@@ -5,0 +5,0 @@ "engines": { |
# express-http-proxy [![NPM version](https://badge.fury.io/js/express-http-proxy.svg)](http://badge.fury.io/js/express-http-proxy) [![Build Status](https://travis-ci.org/villadora/express-http-proxy.svg?branch=master)](https://travis-ci.org/villadora/express-http-proxy) [![Dependency Status](https://gemnasium.com/villadora/express-http-proxy.svg)](https://gemnasium.com/villadora/express-http-proxy) | ||
Express middleware to proxy request to another host and pass response back | ||
Express middleware to proxy request to another host and pass response back to original caller. | ||
## NOTE: Breaking changes for version 1.0.0 | ||
## NOTE: Interface for 1.0.0 is still iterating on master. | ||
## NOTE: version 1.0.0 released: breaking changes, transition guide at bottom of doc. | ||
1. | ||
```decorateRequest``` has been REMOVED, and will generate an error when called. See ```proxyReqOptDecorator``` and ```decorateProxyReqBody```. | ||
Resolution: Most authors will simply need to change the method name for their | ||
decorateRequest method; if author was decorating reqOpts and reqBody in the | ||
same method, this will need to be split up. | ||
2. | ||
```intercept``` has been REMOVED, and will generate an error when called. See ```userResDecorator```. | ||
Resolution: Most authors will simply need to change the method name from ```intercept``` to ```userResDecorator```, and exit the method by returning the value, rather than passing it to a callback. E.g.: | ||
Before: | ||
```js | ||
app.use('/proxy', proxy('www.google.com', { | ||
intercept: function(proxyRes, proxyResData, userReq, userRes, cb) { | ||
data = JSON.parse(proxyResData.toString('utf8')); | ||
data.newProperty = 'exciting data'; | ||
cb(null, JSON.stringify(data)); | ||
} | ||
})); | ||
``` | ||
Now: | ||
```js | ||
app.use('/proxy', proxy('www.google.com', { | ||
userResDecorator: function(proxyRes, proxyResData, userReq, userRes) { | ||
data = JSON.parse(proxyResData.toString('utf8')); | ||
data.newProperty = 'exciting data'; | ||
return JSON.stringify(data); | ||
} | ||
})); | ||
``` | ||
3. | ||
```forwardPath``` and ```forwardPathAsync``` have been DEPRECATED and will generate a warning when called. See ```proxyReqPathResolver```. | ||
Resolution: Simple update the name of either ```forwardPath``` or ```forwardPathAsync``` to ```proxyReqPathResolver```. | ||
## Install | ||
@@ -360,2 +317,46 @@ | ||
## Upgrade to 1.0, transition guide and breaking changes | ||
1. | ||
```decorateRequest``` has been REMOVED, and will generate an error when called. See ```proxyReqOptDecorator``` and ```decorateProxyReqBody```. | ||
Resolution: Most authors will simply need to change the method name for their | ||
decorateRequest method; if author was decorating reqOpts and reqBody in the | ||
same method, this will need to be split up. | ||
2. | ||
```intercept``` has been REMOVED, and will generate an error when called. See ```userResDecorator```. | ||
Resolution: Most authors will simply need to change the method name from ```intercept``` to ```userResDecorator```, and exit the method by returning the value, rather than passing it to a callback. E.g.: | ||
Before: | ||
```js | ||
app.use('/proxy', proxy('www.google.com', { | ||
intercept: function(proxyRes, proxyResData, userReq, userRes, cb) { | ||
data = JSON.parse(proxyResData.toString('utf8')); | ||
data.newProperty = 'exciting data'; | ||
cb(null, JSON.stringify(data)); | ||
} | ||
})); | ||
``` | ||
Now: | ||
```js | ||
app.use('/proxy', proxy('www.google.com', { | ||
userResDecorator: function(proxyRes, proxyResData, userReq, userRes) { | ||
data = JSON.parse(proxyResData.toString('utf8')); | ||
data.newProperty = 'exciting data'; | ||
return JSON.stringify(data); | ||
} | ||
})); | ||
``` | ||
3. | ||
```forwardPath``` and ```forwardPathAsync``` have been DEPRECATED and will generate a warning when called. See ```proxyReqPathResolver```. | ||
Resolution: Simple update the name of either ```forwardPath``` or ```forwardPathAsync``` to ```proxyReqPathResolver```. | ||
## Questions | ||
@@ -388,2 +389,3 @@ | ||
| --- | --- | | ||
| 1.0.1 | Minor docs adjustments. | | ||
| 1.0.0 | Major revision. <br > REMOVE decorateRequest, ADD proxyReqOptDecorator and decorateProxyReqBody. <br /> REMOVE intercept, ADD userResDecorator <br /> userResDecorator supports a Promise form for async operations. <br /> General cleanup of structure and application of hooks. Documentation improvements. Update all dependencies. Re-organize code as a series of workflow steps, each (potentially) supporting a promise, and creating a reusable pattern for future development. | | ||
@@ -390,0 +392,0 @@ | 0.11.0 | Allow author to prevent host from being memoized between requests. General program cleanup. | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24535716
405
4