Function: applyHttpErrorHeaders()
applyHttpErrorHeaders(
__namedParameters):void
Defined in: httpError.ts:137
Copies the headers a thrower attached to an error onto the response — the
WWW-Authenticate header of a 401, above all.
Call it from a catch-all error middleware alongside toHttpError: without this half the status is right but MCP discovery is still broken, because the header that names the authorization server never reaches the client. Non-string header values are ignored; a value that is not an error object, or an error without headers, is a no-op.
Parameters
| Parameter | Type | Description |
|---|---|---|
__namedParameters | { ctx: Context; error: unknown; } | - |
__namedParameters.ctx | Context | The Koa context whose response headers are being written. |
__namedParameters.error | unknown | The caught value, of unknown shape. |
Returns
void