@@ -11,6 +11,7 @@ import Macroable from '@poppinss/macroable'
1111import type { Application } from '@adonisjs/application'
1212
1313import { Route } from './route.js'
14+ import type { HttpContext } from '../http_context/main.js'
1415import type { ParsedGlobalMiddleware } from '../types/middleware.js'
1516import type { MakeUrlOptions , RouteFn , RouteMatchers } from '../types/route.js'
1617
@@ -87,27 +88,33 @@ export class BriskRoute extends Macroable {
8788 params ?: any [ ] | Record < string , any > ,
8889 options ?: MakeUrlOptions & { status : number }
8990 ) : Route {
90- return this . setHandler ( async function redirectsToRoute ( ctx ) {
91+ function redirectsToRoute ( ctx : HttpContext ) {
9192 const redirector = ctx . response . redirect ( )
9293 if ( options ?. status ) {
9394 redirector . status ( options . status )
9495 }
9596
9697 return redirector . toRoute ( identifier , params || ctx . params , options )
97- } )
98+ }
99+ Object . defineProperty ( redirectsToRoute , 'listArgs' , { value : identifier , writable : false } )
100+
101+ return this . setHandler ( redirectsToRoute )
98102 }
99103
100104 /**
101105 * Redirect request to a fixed URL
102106 */
103107 redirectToPath ( url : string , options ?: { status : number } ) : Route {
104- return this . setHandler ( async function redirectsToPath ( ctx ) {
108+ function redirectsToPath ( ctx : HttpContext ) {
105109 const redirector = ctx . response . redirect ( )
106110 if ( options ?. status ) {
107111 redirector . status ( options . status )
108112 }
109113
110114 return redirector . toPath ( url )
111- } )
115+ }
116+ Object . defineProperty ( redirectsToPath , 'listArgs' , { value : url , writable : false } )
117+
118+ return this . setHandler ( redirectsToPath )
112119 }
113120}
0 commit comments