Use route.fullPath when adding trailing slash

There's no need to specially construct the path.
This commit is contained in:
Asher 2020-04-02 11:32:19 -05:00
parent 411c61fb02
commit 498becd11f
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 3 additions and 3 deletions

View File

@ -49,14 +49,14 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider
} }
// Ensure there is a trailing slash so relative paths work correctly. // Ensure there is a trailing slash so relative paths work correctly.
const port = route.base.replace(/^\//, "")
const base = `${this.options.base}/${port}`
if (this.isRoot(route) && !route.fullPath.endsWith("/")) { if (this.isRoot(route) && !route.fullPath.endsWith("/")) {
return { return {
redirect: `${base}/`, redirect: `${route.fullPath}/`,
} }
} }
const port = route.base.replace(/^\//, "")
const base = `${this.options.base}/${port}`
const payload = this.doProxy(route, request, response, port, base) const payload = this.doProxy(route, request, response, port, base)
if (payload) { if (payload) {
return payload return payload