@@ -29,12 +29,10 @@ describe('URL Storage tests', () => {
2929 type : 'url' ,
3030 url : 'http://someUrl.com/file.json' ,
3131 method : 'get' ,
32- headers : [
33- {
34- 'Content-Type' : 'application/json' ,
35- Authorization : 'Bearer auth_token_X'
36- }
37- ] ,
32+ headers : {
33+ 'Content-Type' : 'application/json' ,
34+ Authorization : 'Bearer auth_token_X'
35+ } ,
3836 encryptedBy : nodeId ,
3937 encryptMethod : EncryptMethod . AES
4038 }
@@ -70,12 +68,10 @@ describe('URL Storage tests', () => {
7068 file = {
7169 type : 'url' ,
7270 method : 'get' ,
73- headers : [
74- {
75- 'Content-Type' : 'application/json' ,
76- Authorization : 'Bearer auth_token_X'
77- }
78- ]
71+ headers : {
72+ 'Content-Type' : 'application/json' ,
73+ Authorization : 'Bearer auth_token_X'
74+ }
7975 }
8076 try {
8177 Storage . getStorageClass ( file , config )
@@ -88,12 +84,10 @@ describe('URL Storage tests', () => {
8884 file = {
8985 type : 'url' ,
9086 url : 'http://someUrl.com/file.json' ,
91- headers : [
92- {
93- 'Content-Type' : 'application/json' ,
94- Authorization : 'Bearer auth_token_X'
95- }
96- ]
87+ headers : {
88+ 'Content-Type' : 'application/json' ,
89+ Authorization : 'Bearer auth_token_X'
90+ }
9791 }
9892 try {
9993 Storage . getStorageClass ( file , config )
@@ -109,12 +103,10 @@ describe('URL Storage tests', () => {
109103 type : 'url' ,
110104 url : 'http://someUrl.com/file.json' ,
111105 method : 'put' ,
112- headers : [
113- {
114- 'Content-Type' : 'application/json' ,
115- Authorization : 'Bearer auth_token_X'
116- }
117- ]
106+ headers : {
107+ 'Content-Type' : 'application/json' ,
108+ Authorization : 'Bearer auth_token_X'
109+ }
118110 }
119111 try {
120112 Storage . getStorageClass ( file , config )
@@ -129,12 +121,10 @@ describe('URL Storage tests', () => {
129121 type : 'url' ,
130122 url : './../dir/file.json' ,
131123 method : 'get' ,
132- headers : [
133- {
134- 'Content-Type' : 'application/json' ,
135- Authorization : 'Bearer auth_token_X'
136- }
137- ]
124+ headers : {
125+ 'Content-Type' : 'application/json' ,
126+ Authorization : 'Bearer auth_token_X'
127+ }
138128 }
139129 try {
140130 Storage . getStorageClass ( file , config )
@@ -150,12 +140,10 @@ describe('URL Storage tests', () => {
150140 type : 'url' ,
151141 url : 'http://someUrl.com/file.json' ,
152142 method : 'get' ,
153- headers : [
154- {
155- 'Content-Type' : 'application/json' ,
156- Authorization : 'Bearer auth_token_X'
157- }
158- ]
143+ headers : {
144+ 'Content-Type' : 'application/json' ,
145+ Authorization : 'Bearer auth_token_X'
146+ }
159147 }
160148 storage = Storage . getStorageClass ( file , config )
161149 expect ( storage . getDownloadUrl ( ) ) . to . eql ( 'http://someUrl.com/file.json' )
@@ -172,12 +160,12 @@ describe('URL Storage tests', () => {
172160 expect ( stream ) . not . to . eql ( null )
173161 } )
174162
175- it ( 'Gets readable stream with headers' , async ( ) => {
163+ it ( 'Gets readable stream with headers as plain object ' , async ( ) => {
176164 file = {
177165 type : 'url' ,
178166 url : 'https://stock-api.oceanprotocol.com/stock/stock.json' ,
179167 method : 'get' ,
180- headers : [ { 'X-Test-Header' : 'test' } ]
168+ headers : { 'X-Test-Header' : 'test' }
181169 }
182170 const storage = Storage . getStorageClass ( file , config )
183171 const stream = await storage . getReadableStream ( )
0 commit comments