File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,25 @@ describe('App', () => {
9595 chai . expect ( responseCombined2 . body . message ) . to . include ( 'Data URIs' ) ;
9696 } ) ;
9797
98+ it ( 'should block data URI in onRequest hook before wildcardRequestHandler (prevents FragmentError)' , async ( ) => {
99+ // Production NewRelic alert scenario: data URI reached wildcardRequestHandler -> special:404 -> FragmentError
100+ // This test verifies the fix: data URI blocked in onRequest with 400, never reaches wildcardRequestHandler
101+ const productionDataUri =
102+ '/data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJiIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMTQ0IiBoZWlnaHQ9IjY1NSI' ;
103+
104+ const response = await server . get ( productionDataUri ) . expect ( 400 ) ;
105+
106+ // Verify: Blocked with 400 (not 404 which would indicate wildcardRequestHandler was reached)
107+ chai . expect ( response . status ) . to . equal ( 400 ) ;
108+ chai . expect ( response . body . message ) . to . include ( 'Bad Request' ) ;
109+ chai . expect ( response . body . message ) . to . include ( 'Data URIs' ) ;
110+
111+ // Key assertion: Status is 400, not 404
112+ // If this were 404, it would mean wildcardRequestHandler processed it as special:404
113+ // which would trigger Tailor fragment fetching -> FragmentError in NewRelic
114+ chai . expect ( response . status ) . to . not . equal ( 404 ) ;
115+ } ) ;
116+
98117 it ( 'should parse "invalid" urls' , async ( ) => {
99118 await server . get ( '///' ) . expect ( 200 ) ;
100119 } ) ;
You can’t perform that action at this time.
0 commit comments