File tree Expand file tree Collapse file tree
dotcom-rendering/src/server/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,8 +11,15 @@ const getTargetGroupHeaderValue = () => {
1111 return 'dev' ;
1212} ;
1313
14- const backendApp = process . env . GU_APP ?? 'rendering' ;
15- const targetGroup = getTargetGroupHeaderValue ( ) ;
14+ const getHeaders : ( ) => Record < string , string > = ( ) => {
15+ const backendApp = process . env . GU_APP ?? 'rendering' ;
16+ const targetGroup = getTargetGroupHeaderValue ( ) ;
17+
18+ return {
19+ 'X-Gu-Backend-App' : backendApp ,
20+ 'X-Gu-Backend-App-Target-Group' : targetGroup ,
21+ } ;
22+ } ;
1623
1724/**
1825 * Middleware to add response headers useful for debugging.
@@ -24,10 +31,7 @@ export const responseHeaderMiddleware: RequestHandler = (
2431 res : Response ,
2532 next : NextFunction ,
2633) => {
27- const headers = {
28- 'X-Gu-Backend-App' : backendApp ,
29- 'X-Gu-Backend-App-Target-Group' : targetGroup ,
30- } ;
34+ const headers = getHeaders ( ) ;
3135
3236 for ( const [ key , value ] of Object . entries ( headers ) ) {
3337 res . setHeader ( key , value ) ;
You can’t perform that action at this time.
0 commit comments