Skip to content

Commit b10932c

Browse files
Merge pull request #199 from wahajahmed010/fix/192-190-param-decorator-cors-docs
refactor: simplify param decorator lookup and document CORS pipeline step
2 parents 3b933e5 + d65a335 commit b10932c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/http/routing/route-registry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ export class RouteRegistry {
449449
* Execute a route handler with middleware pipeline
450450
*
451451
* Executes the full middleware pipeline:
452+
* 0. CORS - Handle CORS headers and preflight
452453
* 1. Guards - Authorization checks
453454
* 2. Body parsing - Parse request body if present
454455
* 3. Pipes - Transform/validate body

src/websocket/decorators/param-decorator.utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ export function createParamDecorator(
7171
];
7272

7373
// Check if this parameter index already has metadata
74-
const existingIndex = existingParams.findIndex((p) => p.index === parameterIndex);
75-
if (existingIndex !== -1) {
76-
const existing = existingParams[existingIndex];
74+
const existing = existingParams.find((p) => p.index === parameterIndex);
75+
if (existing) {
7776
const existingDecoratorName = PARAM_TYPE_TO_DECORATOR_NAME[existing.type];
7877
throw new Error(
7978
`${decoratorName} decorator: parameter at index ${parameterIndex} already has @${existingDecoratorName} decorator applied. ` +

0 commit comments

Comments
 (0)