@@ -52,10 +52,7 @@ describe('delegated-routing-v1-http-api-client', () => {
5252 // load providers for the router to fetch
5353 await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
5454 method : 'POST' ,
55- headers : {
56- 'Content-Type' : 'application/json'
57- } ,
58- body : JSON . stringify ( { Providers : providers } )
55+ body : providers . map ( prov => JSON . stringify ( prov ) ) . join ( '\n' )
5956 } )
6057
6158 const provs = await all ( client . getProviders ( cid ) )
@@ -103,26 +100,6 @@ describe('delegated-routing-v1-http-api-client', () => {
103100 }
104101 } )
105102
106- it ( 'should handle non-json input' , async ( ) => {
107- const cid = CID . parse ( 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' )
108-
109- const response = await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
110- method : 'POST' ,
111- headers : {
112- 'Content-Type' : 'text/plain'
113- } ,
114- body : 'not json'
115- } )
116-
117- expect ( response . status ) . to . equal ( 400 )
118- const errorData = await response . json ( )
119- expect ( errorData ) . to . have . property ( 'error' )
120- expect ( errorData ) . to . have . property ( 'code' , 'ERR_INVALID_INPUT' )
121-
122- const provs = await all ( client . getProviders ( cid ) )
123- expect ( provs ) . to . be . empty ( )
124- } )
125-
126103 it ( 'should add filter parameters the query of the request url' , async ( ) => {
127104 const providers = [ {
128105 Protocol : 'transport-bitswap' ,
@@ -180,7 +157,7 @@ describe('delegated-routing-v1-http-api-client', () => {
180157 expect ( searchParams . get ( 'filter-addrs' ) ) . to . equal ( 'tcp,!p2p-circuit' )
181158 } )
182159
183- it ( 'should handle non-json input without content-type header ' , async ( ) => {
160+ it ( 'should handle non-json input' , async ( ) => {
184161 const cid = CID . parse ( 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' )
185162
186163 // load providers for the router to fetch
@@ -375,10 +352,7 @@ describe('delegated-routing-v1-http-api-client', () => {
375352 // load providers for the router to fetch
376353 await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
377354 method : 'POST' ,
378- headers : {
379- 'Content-Type' : 'application/json'
380- } ,
381- body : JSON . stringify ( { Providers : providers } )
355+ body : providers . map ( prov => JSON . stringify ( prov ) ) . join ( '\n' )
382356 } )
383357
384358 // Reset call count before our test
@@ -431,10 +405,7 @@ describe('delegated-routing-v1-http-api-client', () => {
431405 // load providers for the router to fetch
432406 await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
433407 method : 'POST' ,
434- headers : {
435- 'Content-Type' : 'application/json'
436- } ,
437- body : JSON . stringify ( { Providers : providers } )
408+ body : providers . map ( prov => JSON . stringify ( prov ) ) . join ( '\n' )
438409 } )
439410
440411 // Reset call count
0 commit comments