(
req: WebsocketRequest,
opts?: {
passthroughPath?: boolean
proxyBasePath?: string
},
)
| 56 | } |
| 57 | |
| 58 | export async function wsProxy( |
| 59 | req: WebsocketRequest, |
| 60 | opts?: { |
| 61 | passthroughPath?: boolean |
| 62 | proxyBasePath?: string |
| 63 | }, |
| 64 | ): Promise<void> { |
| 65 | ensureProxyEnabled(req) |
| 66 | ensureOrigin(req) |
| 67 | await ensureAuthenticated(req) |
| 68 | |
| 69 | // The base is used for rewriting (redirects, target). |
| 70 | if (!opts?.passthroughPath) { |
| 71 | ;(req as any).base = req.path.split(path.sep).slice(0, 3).join(path.sep) |
| 72 | } |
| 73 | |
| 74 | _proxy.ws(req, req.ws, req.head, { |
| 75 | ignorePath: true, |
| 76 | target: getProxyTarget(req, opts), |
| 77 | }) |
| 78 | } |
nothing calls this directly
no test coverage detected