|
@ -20,7 +20,7 @@ function proxyRequest (route, app) { |
|
|
changeOrigin: true |
|
|
changeOrigin: true |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
return function * proxyMiddleware () { |
|
|
|
|
|
|
|
|
return function proxyMiddleware () { |
|
|
const next = arguments[arguments.length - 1] |
|
|
const next = arguments[arguments.length - 1] |
|
|
const keys = [] |
|
|
const keys = [] |
|
|
route.re = pathToRegexp(route.from, keys) |
|
|
route.re = pathToRegexp(route.from, keys) |
|
@ -29,7 +29,7 @@ function proxyRequest (route, app) { |
|
|
keys.forEach((key, index) => { |
|
|
keys.forEach((key, index) => { |
|
|
const re = RegExp(`:${key.name}`, 'g') |
|
|
const re = RegExp(`:${key.name}`, 'g') |
|
|
route.new = route.new |
|
|
route.new = route.new |
|
|
.replace(re, arguments[index] || '') |
|
|
|
|
|
|
|
|
.replace(re, arguments[index + 1] || '') |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
/* test no keys remain in the new path */ |
|
|
/* test no keys remain in the new path */ |
|
|