ensure body-parser middleware is further downstream than rewrite.. fixes #30.
This commit is contained in:
@ -84,9 +84,6 @@ function localWebServer (options) {
|
||||
/* pretty print JSON */
|
||||
app.use(json())
|
||||
|
||||
/* request body parser */
|
||||
app.use(bodyParser())
|
||||
|
||||
/* rewrite rules */
|
||||
if (options.rewrite && options.rewrite.length) {
|
||||
options.rewrite.forEach(route => {
|
||||
@ -104,6 +101,9 @@ function localWebServer (options) {
|
||||
})
|
||||
}
|
||||
|
||||
/* must come after rewrite. See https://github.com/nodejitsu/node-http-proxy/issues/180. */
|
||||
app.use(bodyParser())
|
||||
|
||||
/* path blacklist */
|
||||
if (options.forbid.length) {
|
||||
debug('forbid', options.forbid.join(', '))
|
||||
|
@ -50,6 +50,7 @@ function proxyRequest (route, app) {
|
||||
proxy.once('proxyReq', function (proxyReq) {
|
||||
proxyReq.path = url.parse(route.new).path
|
||||
})
|
||||
|
||||
proxy.web(this.req, this.res, { target: route.new })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user