@@ -75,33 +75,34 @@ function preventFetchFn(
7575 responseProps . type = { value : responseType } ;
7676 }
7777 }
78+ const fetchProps = ( src , out ) => {
79+ if ( typeof src !== 'object' || src === null ) { return ; }
80+ const props = [
81+ 'body' , 'cache' , 'credentials' , 'duplex' , 'headers' ,
82+ 'integrity' , 'keepalive' , 'method' , 'mode' , 'priority' ,
83+ 'redirect' , 'referrer' , 'referrerPolicy' , 'signal' ,
84+ ] ;
85+ for ( const prop of props ) {
86+ if ( src [ prop ] === undefined ) { continue ; }
87+ out [ prop ] = src [ prop ] ;
88+ }
89+ } ;
90+ const fetchDetails = args => {
91+ const out = { } ;
92+ if ( args [ 0 ] instanceof self . Request ) {
93+ out . url = `${ args [ 0 ] . url } ` ;
94+ fetchProps ( args [ 0 ] , out ) ;
95+ } else {
96+ out . url = `${ args [ 0 ] } ` ;
97+ }
98+ fetchProps ( args [ 1 ] , out ) ;
99+ return out ;
100+ } ;
78101 proxyApplyFn ( 'fetch' , function fetch ( context ) {
79102 const { callArgs } = context ;
80- const details = ( ( ) => {
81- const fetchProps = ( src , out ) => {
82- if ( typeof src !== 'object' || src === null ) { return ; }
83- const props = [
84- 'body' , 'cache' , 'credentials' , 'duplex' , 'headers' ,
85- 'integrity' , 'keepalive' , 'method' , 'mode' , 'priority' ,
86- 'redirect' , 'referrer' , 'referrerPolicy' , 'signal' ,
87- ] ;
88- for ( const prop of props ) {
89- if ( src [ prop ] === undefined ) { continue ; }
90- out [ prop ] = src [ prop ] ;
91- }
92- } ;
93- const out = { } ;
94- if ( callArgs [ 0 ] instanceof self . Request ) {
95- out . url = `${ callArgs [ 0 ] . url } ` ;
96- fetchProps ( callArgs [ 0 ] , out ) ;
97- } else {
98- out . url = `${ callArgs [ 0 ] } ` ;
99- }
100- fetchProps ( callArgs [ 1 ] , out ) ;
101- return out ;
102- } ) ( ) ;
103+ const details = fetchDetails ( callArgs ) ;
103104 if ( safe . logLevel > 1 || propsToMatch === '' && responseBody === '' ) {
104- const out = Array . from ( details ) . map ( a => `${ a [ 0 ] } :${ a [ 1 ] } ` ) ;
105+ const out = Array . from ( Object . entries ( details ) ) . map ( a => `${ a [ 0 ] } :${ a [ 1 ] } ` ) ;
105106 safe . uboLog ( logPrefix , `Called: ${ out . join ( '\n' ) } ` ) ;
106107 }
107108 if ( propsToMatch === '' && responseBody === '' ) {
0 commit comments