File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -938,13 +938,10 @@ describe('Session', () => {
938938 // drain
939939 }
940940
941- const calledHeaders = ( mockFetch . mock . calls [ 0 ] ! [ 1 ] as RequestInit ) . headers as Record <
942- string ,
943- string
944- >
945- expect ( calledHeaders [ 'content-type' ] ) . toBe ( 'application/json' )
946- expect ( calledHeaders [ 'x-custom' ] ) . toBe ( 'value' )
947- expect ( calledHeaders . Accept ) . toBe ( 'text/event-stream' )
941+ const calledHeaders = new Headers ( ( mockFetch . mock . calls [ 0 ] ! [ 1 ] as RequestInit ) . headers )
942+ expect ( calledHeaders . get ( 'content-type' ) ) . toBe ( 'application/json' )
943+ expect ( calledHeaders . get ( 'x-custom' ) ) . toBe ( 'value' )
944+ expect ( calledHeaders . get ( 'accept' ) ) . toBe ( 'text/event-stream' )
948945 } )
949946 } )
950947
@@ -1085,15 +1082,6 @@ describe('Session', () => {
10851082 } ,
10861083 } )
10871084
1088- onChannelUpdate ?.( {
1089- channelId,
1090- salt : '0x01' as Hex ,
1091- cumulativeAmount : 5_000_000n ,
1092- escrowContract : '0x0000000000000000000000000000000000000001' as Address ,
1093- chainId : 4217 ,
1094- opened : true ,
1095- } )
1096-
10971085 await s . fetch ( 'https://api.example.com/data' )
10981086 await s . close ( )
10991087
Original file line number Diff line number Diff line change @@ -217,12 +217,12 @@ export function sessionManager(parameters: sessionManager.Parameters): SessionMa
217217
218218 async sse ( input , init ) {
219219 const { onReceipt, signal, ...fetchInit } = init ?? { }
220+ const headers = new Headers ( fetchInit . headers )
221+ headers . set ( 'Accept' , 'text/event-stream' )
222+
220223 const sseInit = {
221224 ...fetchInit ,
222- headers : {
223- ...Fetch . normalizeHeaders ( fetchInit . headers ) ,
224- Accept : 'text/event-stream' ,
225- } ,
225+ headers,
226226 ...( signal ? { signal } : { } ) ,
227227 }
228228
You can’t perform that action at this time.
0 commit comments