@@ -22,7 +22,13 @@ import {
2222} from '../lib/index.js' ;
2323import { ExpressServerTiming , IExtensionInterface } from './timing/index.js' ;
2424
25- import { XActionEvent , XRequest , XResponse } from '../lib/express.js' ;
25+ import {
26+ XActionEvent ,
27+ XPath ,
28+ XQuery ,
29+ XRequest ,
30+ XResponse ,
31+ } from '../lib/express.js' ;
2632import { BaseUserAgent } from './BaseUserAgent.js' ;
2733
2834export default abstract class BaseAction <
@@ -175,6 +181,18 @@ export default abstract class BaseAction<
175181 res : XResponse ,
176182 next : ( ) => void ,
177183 ) : Promise < void > {
184+ const xPath : XPath = { } ;
185+ Object . entries ( req . params ) . forEach ( ( [ k , v ] ) => {
186+ if ( typeof v === 'string' ) {
187+ xPath [ k ] = v ;
188+ }
189+ } ) ;
190+ const xQuery : XQuery = { } ;
191+ Object . entries ( req . query ) . forEach ( ( [ k , v ] ) => {
192+ if ( typeof v === 'string' || v === undefined ) {
193+ xQuery [ k ] = v ;
194+ }
195+ } ) ;
178196 const extension = this . initExtension ( res ) ;
179197 const auth = extension . timing . start ( 'auth' ) ;
180198 res . on ( 'finish' , ( ) => {
@@ -213,6 +231,8 @@ export default abstract class BaseAction<
213231 extension,
214232 agent : new BaseUserAgent ( req ) ,
215233 body,
234+ path : xPath ,
235+ query : xQuery ,
216236 sendError : ( code : number , error : Partial < ErrorType > ) =>
217237 BaseAction . sendError ( res , code , error ) ,
218238 } ) ;
@@ -250,6 +270,8 @@ export default abstract class BaseAction<
250270 extension,
251271 agent : new BaseUserAgent ( req ) ,
252272 body,
273+ path : xPath ,
274+ query : xQuery ,
253275 sendError : ( code : number , error : Partial < ErrorType > ) =>
254276 BaseAction . sendError ( res , code , error ) ,
255277 } ) ;
@@ -283,6 +305,8 @@ export default abstract class BaseAction<
283305 extension,
284306 agent : new BaseUserAgent ( req ) ,
285307 body,
308+ path : xPath ,
309+ query : xQuery ,
286310 sendError : ( code : number , error : Partial < ErrorType > ) =>
287311 BaseAction . sendError ( res , code , error ) ,
288312 } ) ;
0 commit comments