@@ -42,17 +42,16 @@ export function Handler(method?: HttpVerb): MethodDecorator {
4242 }
4343
4444 return function ( target : object , propertyKey : string | symbol , descriptor : TypedPropertyDescriptor < any > ) {
45- const httpCode : number | undefined = Reflect . getMetadata ( HTTP_CODE_TOKEN , target . constructor , propertyKey ) ;
46- const metaParameters : Array < MetaParameter > = (
47- Reflect . getMetadata ( PARAMETER_TOKEN , target . constructor , propertyKey ) ?? [ ]
48- ) . sort ( ( a : MetaParameter , b : MetaParameter ) => a . index - b . index ) ;
49-
5045 const originalHandler = descriptor . value ;
5146 descriptor . value = async function ( req : NextApiRequest , res : NextApiResponse ) {
5247 if ( req . method !== method ) {
5348 return notFound ( req , res ) ;
5449 }
5550
51+ const httpCode : number | undefined = Reflect . getMetadata ( HTTP_CODE_TOKEN , target . constructor , propertyKey ) ;
52+ const metaParameters : Array < MetaParameter > = (
53+ Reflect . getMetadata ( PARAMETER_TOKEN , target . constructor , propertyKey ) ?? [ ]
54+ ) . sort ( ( a : MetaParameter , b : MetaParameter ) => a . index - b . index ) ;
5655 const classHeaders : Map < string , string > | undefined = Reflect . getMetadata ( HEADER_TOKEN , target . constructor ) ;
5756 const methodHeaders : Map < string , string > | undefined = Reflect . getMetadata (
5857 HEADER_TOKEN ,
0 commit comments