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.