@@ -74,12 +74,12 @@ function handleRequest(enable, authorize, req, res) {
7474 }
7575
7676 if ( ! requestPath . startsWith ( resourcePath ) ) {
77- var id = startProfiling ( req , enabled , authorized ) ;
77+ var extension = startProfiling ( req , enabled , authorized ) ;
7878 if ( enabled ) {
7979 res . on ( 'finish' , ( ) => {
80- stopProfiling ( req ) ;
80+ stopProfiling ( extension , req ) ;
8181 } ) ;
82- res . setHeader ( 'X-MiniProfiler-Ids' , `["${ id } "]` ) ;
82+ res . setHeader ( 'X-MiniProfiler-Ids' , `["${ extension . id } "]` ) ;
8383 }
8484 return resolve ( false ) ;
8585 }
@@ -279,21 +279,19 @@ function include(id) {
279279 } ;
280280
281281 request . miniprofiler = currentRequestExtension ;
282- return currentRequestExtension . id ;
282+
283+ return currentRequestExtension ;
283284}
284285
285286/*
286287 * Stops profiling the given request.
287288 */
288- function stopProfiling ( request ) {
289- var extension = request . miniprofiler ;
289+ function stopProfiling ( extension , request ) {
290290 var time = process . hrtime ( ) ;
291291
292292 extension . stopTime = time ;
293293 extension . stepGraph . stopTime = time ;
294294
295- delete request . miniprofiler ;
296-
297295 var json = describePerformance ( extension , request ) ;
298296 storage . set ( extension . id , JSON . stringify ( json ) ) ;
299297}
0 commit comments