Archived
1
0

Rename hxxp to isHttp

This commit is contained in:
Asher 2020-04-01 11:05:10 -05:00
parent e7e7b0ffb7
commit 74a0bacdcf
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -168,15 +168,15 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider
// the event. // the event.
;(request as Request).base = base ;(request as Request).base = base
const hxxp = response instanceof http.ServerResponse const isHttp = response instanceof http.ServerResponse
const path = base ? route.fullPath.replace(base, "") : route.fullPath const path = base ? route.fullPath.replace(base, "") : route.fullPath
const options: proxy.ServerOptions = { const options: proxy.ServerOptions = {
changeOrigin: true, changeOrigin: true,
ignorePath: true, ignorePath: true,
target: `${hxxp ? "http" : "ws"}://127.0.0.1:${port}${path}${ target: `${isHttp ? "http" : "ws"}://127.0.0.1:${port}${path}${
Object.keys(route.query).length > 0 ? `?${querystring.stringify(route.query)}` : "" Object.keys(route.query).length > 0 ? `?${querystring.stringify(route.query)}` : ""
}`, }`,
ws: !hxxp, ws: !isHttp,
} }
if (response instanceof http.ServerResponse) { if (response instanceof http.ServerResponse) {