- Introduction
- Quick start
- Philosophy
- Comparison
- Default behaviors
- Limitations
- Debugging runbook
- FAQ
- Mocking HTTP
- Mocking SSE
- Mocking GraphQL
- Mocking WebSocket
- Integrations
- API
- CLI
- Best practices
- Recipes
Erroring the connection
Mocking SSE connection error.
You can error the intercepted client connection by calling client.error() in your request handler:
sse('/stream', ({ client }) => {
client.error()
})Client connection errors do not accept the closure reason.
Unlike client.close(), calling client.error() aborts the connection, which will dispatch the error event on the underlying EventSource instance.