File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed
Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -68,15 +68,17 @@ export async function getAuthenticatedClient(accessToken?: string) {
6868 accessToken = token ;
6969 }
7070
71- // Check for mock scenario cookie (development only)
7271 const requestHeaders : Record < string , string > = {
7372 Authorization : `Bearer ${ accessToken } ` ,
7473 } ;
7574
76- const cookieStore = await cookies ( ) ;
77- const mockScenario = cookieStore . get ( MOCK_SCENARIO_COOKIE ) ?. value ;
78- if ( mockScenario ) {
79- requestHeaders [ MOCK_SCENARIO_HEADER ] = mockScenario ;
75+ // Mock scenario header is only used in development for testing different backend states
76+ if ( process . env . NODE_ENV === "development" ) {
77+ const cookieStore = await cookies ( ) ;
78+ const mockScenario = cookieStore . get ( MOCK_SCENARIO_COOKIE ) ?. value ;
79+ if ( mockScenario ) {
80+ requestHeaders [ MOCK_SCENARIO_HEADER ] = mockScenario ;
81+ }
8082 }
8183
8284 // Create a new client instance per request to avoid race conditions
Original file line number Diff line number Diff line change @@ -29,17 +29,10 @@ export function mockScenario(
2929 ) : HttpHandler =>
3030 httpMethod ( path , ( info ) => {
3131 const headerValue = info . request . headers . get ( SCENARIO_HEADER ) ;
32- console . log (
33- `[mockScenario] ${ method . toUpperCase ( ) } ${ info . request . url } ` ,
34- `| header "${ SCENARIO_HEADER } "="${ headerValue } "` ,
35- `| expected="${ scenario } "` ,
36- `| match=${ headerValue === scenario } ` ,
37- ) ;
3832
3933 if ( headerValue !== scenario ) {
4034 return ;
4135 }
42- console . log ( `[mockScenario] ACTIVATED scenario "${ scenario } "` ) ;
4336 return handler ( info ) ;
4437 } ) ;
4538 } ,
You can’t perform that action at this time.
0 commit comments