@@ -31,26 +31,30 @@ assert.deepEqual(
3131) ;
3232
3333const diagnosticSecret = 'diagnostic-secret-that-must-not-leak' ;
34+ let diagnosticRequest ;
3435const diagnosticClient = new GnippetsE2EClient ( {
3536 baseUrl : 'https://gnippets.example' ,
3637 controlToken : diagnosticSecret ,
37- fetchImpl : async ( ) => ( {
38- ok : false ,
39- status : 403 ,
40- headers : {
41- get ( name ) {
42- return {
43- server : 'cloudflare' ,
44- 'cf-ray' : 'fixture-ray-IST' ,
45- 'cf-mitigated' : 'challenge' ,
46- 'content-type' : 'text/html' ,
47- } [ name . toLowerCase ( ) ] || null ;
38+ fetchImpl : async ( url , options ) => {
39+ diagnosticRequest = { url, options } ;
40+ return {
41+ ok : false ,
42+ status : 403 ,
43+ headers : {
44+ get ( name ) {
45+ return {
46+ server : 'cloudflare' ,
47+ 'cf-ray' : 'fixture-ray-IST' ,
48+ 'cf-mitigated' : 'challenge' ,
49+ 'content-type' : 'text/html' ,
50+ } [ name . toLowerCase ( ) ] || null ;
51+ } ,
4852 } ,
49- } ,
50- async text ( ) {
51- return `<html><title>Attention Required</title><body>Bearer ${ diagnosticSecret } </body></html>` ;
52- } ,
53- } ) ,
53+ async text ( ) {
54+ return `<html><title>Attention Required</title><body>Bearer ${ diagnosticSecret } </body></html>` ;
55+ } ,
56+ } ;
57+ } ,
5458} ) ;
5559await assert . rejects (
5660 diagnosticClient . createRun ( 'fixture' ) ,
@@ -64,6 +68,8 @@ await assert.rejects(
6468 return true ;
6569 } ,
6670) ;
71+ assert . equal ( diagnosticRequest . options . headers . accept , 'application/json' ) ;
72+ assert . match ( diagnosticRequest . options . headers [ 'user-agent' ] , / W e b B r a i n C l o u d E 2 E / ) ;
6773
6874const mountainScenario = scenarios . find ( ( scenario ) => scenario . id === 'wikipedia-table-extraction' ) ;
6975const invalidMountainHeights = gradeScenario ( {
0 commit comments