feat(routes): per-endpoint duplicates override via @Post/@Get opts

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-07-06 20:16:46 -05:00
1 parent ec2e3a0e62
commit 34017f6ab2
4 files changed
+23 -6

No files matched your search

+2 -2
View File
@@ -31,7 +31,7 @@ export type RouteHandler = (req: {
ip: string;
}) => Promise<PipelineResult>;
export interface RouteDef { method: string; pattern: string; transport: Transport; handler: RouteHandler }
export interface RouteDef { method: string; pattern: string; transport: Transport; handler: RouteHandler; bodyDuplicates?: 'array' | 'last' }
export interface MatchedRoute { params: Record<string, string>; def: RouteDef }
export interface WsOpenCtx {
@@ -258,7 +258,7 @@ export function createHttpServer(
}
let body: unknown;
const ct = String(req.headers['content-type'] ?? '');
const duplicates = opts?.bodyDuplicates ?? 'last';
const duplicates = matched.def.bodyDuplicates ?? opts?.bodyDuplicates ?? 'last';
if (buf !== undefined && ct.includes('application/json')) {
try { body = JSON.parse(buf.toString('utf8')); }
catch {