File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -464,6 +464,8 @@ ca/T0LLtgmbMmxSv/MmzIg==
464
464
} ) ;
465
465
466
466
it ( "should pass the request through if there is no session" , async ( ) => {
467
+ const spyOnNextResponseNext = vi . spyOn ( NextResponse , 'next' ) ;
468
+
467
469
const secret = await generateSecret ( 32 ) ;
468
470
const transactionStore = new TransactionStore ( {
469
471
secret
@@ -489,10 +491,14 @@ ca/T0LLtgmbMmxSv/MmzIg==
489
491
fetch : getMockAuthorizationServer ( )
490
492
} ) ;
491
493
494
+ const headers = new Headers ( ) ;
495
+ headers . append ( "x-custom-header" , `custom-header-value` ) ;
496
+
492
497
const request = new NextRequest (
493
498
"https://example.com/dashboard/projects" ,
494
499
{
495
- method : "GET"
500
+ method : "GET" ,
501
+ headers
496
502
}
497
503
) ;
498
504
@@ -504,6 +510,9 @@ ca/T0LLtgmbMmxSv/MmzIg==
504
510
// assert session has not been updated
505
511
const updatedSessionCookie = response . cookies . get ( "__session" ) ;
506
512
expect ( updatedSessionCookie ) . toBeUndefined ( ) ;
513
+
514
+ // assert that an original request is retained
515
+ expect ( spyOnNextResponseNext ) . toHaveBeenCalledWith ( { request} ) ;
507
516
} ) ;
508
517
} ) ;
509
518
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ export class AuthClient {
245
245
// no auth handler found, simply touch the sessions
246
246
// TODO: this should only happen if rolling sessions are enabled. Also, we should
247
247
// try to avoid reading from the DB (for stateful sessions) on every request if possible.
248
- const res = NextResponse . next ( ) ;
248
+ const res = NextResponse . next ( { request : req } ) ;
249
249
const session = await this . sessionStore . get ( req . cookies ) ;
250
250
251
251
if ( session ) {
You can’t perform that action at this time.
0 commit comments