@@ -52,10 +52,7 @@ describe('delegated-routing-v1-http-api-client', () => {
52
52
// load providers for the router to fetch
53
53
await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
54
54
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' )
59
56
} )
60
57
61
58
const provs = await all ( client . getProviders ( cid ) )
@@ -103,26 +100,6 @@ describe('delegated-routing-v1-http-api-client', () => {
103
100
}
104
101
} )
105
102
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
-
126
103
it ( 'should add filter parameters the query of the request url' , async ( ) => {
127
104
const providers = [ {
128
105
Protocol : 'transport-bitswap' ,
@@ -180,7 +157,7 @@ describe('delegated-routing-v1-http-api-client', () => {
180
157
expect ( searchParams . get ( 'filter-addrs' ) ) . to . equal ( 'tcp,!p2p-circuit' )
181
158
} )
182
159
183
- it ( 'should handle non-json input without content-type header ' , async ( ) => {
160
+ it ( 'should handle non-json input' , async ( ) => {
184
161
const cid = CID . parse ( 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' )
185
162
186
163
// load providers for the router to fetch
@@ -375,10 +352,7 @@ describe('delegated-routing-v1-http-api-client', () => {
375
352
// load providers for the router to fetch
376
353
await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
377
354
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' )
382
356
} )
383
357
384
358
// Reset call count before our test
@@ -431,10 +405,7 @@ describe('delegated-routing-v1-http-api-client', () => {
431
405
// load providers for the router to fetch
432
406
await fetch ( `${ process . env . ECHO_SERVER } /add-providers/${ cid . toString ( ) } ` , {
433
407
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' )
438
409
} )
439
410
440
411
// Reset call count
0 commit comments