未验证 提交 74a0bacd 编写于 作者: A Asher

Rename hxxp to isHttp

上级 e7e7b0ff
...@@ -168,15 +168,15 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider ...@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册