@@ -10,7 +10,7 @@ test.describe('network signals - fetch', () => {
1010 indexPage = await new IndexPage ( ) . loadAndWait ( page , basicEdgeFn )
1111 } )
1212
13- test ( 'should not emit non-json requests' , async ( ) => {
13+ test ( 'should emit non-json requests but not include the data object ' , async ( ) => {
1414 await indexPage . network . mockTestRoute ( 'http://localhost/upload' , {
1515 body : JSON . stringify ( { foo : 'test' } ) ,
1616 } )
@@ -26,10 +26,16 @@ test.describe('network signals - fetch', () => {
2626 ( el ) => el . properties ! . data . action === 'request'
2727 )
2828
29- expect ( requests ) . toHaveLength ( 0 )
29+ expect ( requests [ 0 ] . properties ! . data ) . toMatchObject ( {
30+ action : 'request' ,
31+ contentType : 'multipart/form-data' ,
32+ data : null ,
33+ method : 'POST' ,
34+ url : 'http://localhost/upload' ,
35+ } )
3036 } )
3137
32- test ( 'should try to parse the body of text/plain requests' , async ( ) => {
38+ test ( 'should try to parse the body of any requests with string in the body ' , async ( ) => {
3339 await indexPage . network . mockTestRoute ( 'http://localhost/test' , {
3440 body : JSON . stringify ( { foo : 'test' } ) ,
3541 contentType : 'application/json' ,
@@ -251,19 +257,4 @@ test.describe('network signals - fetch', () => {
251257 expect ( responses ) . toHaveLength ( 1 )
252258 } )
253259 } )
254-
255- test ( 'not emit response errors if there is no corresponding request, even if correct content type' , async ( ) => {
256- await indexPage . network . mockTestRoute ( 'http://localhost/test' , {
257- body : JSON . stringify ( { foo : 'test' } ) ,
258- contentType : 'application/json' ,
259- status : 400 ,
260- } )
261-
262- await indexPage . network . makeFileUploadRequest ( 'http://localhost/test' )
263-
264- await indexPage . waitForSignalsApiFlush ( )
265-
266- const networkEvents = indexPage . signalsAPI . getEvents ( 'network' )
267- expect ( networkEvents ) . toHaveLength ( 0 )
268- } )
269260} )
0 commit comments