feat(http): add error handling for invalid HTTP methods

- Introduce `InvalidHttpMethodError` for unrecognized HTTP methods.
- Enhance type safety in `HttpKernel` by using generic contexts.
- Update `ResponseDecorator` to accept context for enriched responses.

Signed-off-by: Max P. <Mail@MPassarello.de>
This commit is contained in:
2025-05-07 12:35:41 +02:00
parent a236fa7c97
commit ba7aa79f56
3 changed files with 47 additions and 16 deletions

View File

@@ -1,3 +1,5 @@
import { IContext } from '../Interfaces/mod.ts';
/**
* A function that modifies or enriches an outgoing HTTP response before it is returned to the client.
*
@@ -22,4 +24,7 @@
* };
* ```
*/
export type ResponseDecorator = (res: Response) => Response;
export type ResponseDecorator<TContext extends IContext = IContext> = (
res: Response,
ctx: TContext,
) => Response;