(obj: unknown)
| 31 | |
| 32 | /** |
| 33 | * Releases the raw socket behind an upgrade request that no route took |
| 34 | * ownership of, and reports whether it did. Returns false for ordinary |
| 35 | * requests, which still want a normal response. |
| 36 | * |
| 37 | * Both error paths need this. Express skips plain middleware once an error is |
| 38 | * in flight, so the cleanup middleware at the end of the stack is unreachable |
| 39 | * from either of them, and an upgrade's `res` is a detached dummy that swallows |
| 40 | * whatever is written to it — leaving the client hanging until it times out. |
| 41 | */ |
| 42 | export const ownsUnhandledUpgrade = (req: Request): boolean => |
| 43 | req.ws !== undefined && req.ws.handled === false |
no outgoing calls
no test coverage detected