@@ -177,7 +177,7 @@ func TestHTTPClientDownload(t *testing.T) {
177
177
// case 0
178
178
{
179
179
endpoint : "https://status-not-ok.io" ,
180
- expectederror : "Unexpected server response: " ,
180
+ expectederror : ErrUnexpectedEOF . Error () ,
181
181
},
182
182
// case 1
183
183
{
@@ -195,49 +195,44 @@ func TestHTTPClientDownload(t *testing.T) {
195
195
expectederror : "" ,
196
196
},
197
197
// case 4
198
- {
199
- endpoint : "https://unknown-transfer-adapter.io" ,
200
- expectederror : "TransferAdapter not found: " ,
201
- },
202
- // case 5
203
198
{
204
199
endpoint : "https://error-in-response-objects.io" ,
205
200
expectederror : "Object not found" ,
206
201
},
207
- // case 6
202
+ // case 5
208
203
{
209
204
endpoint : "https://empty-actions-map.io" ,
210
- expectederror : "Missing action 'download'" ,
205
+ expectederror : "missing action 'download'" ,
211
206
},
212
- // case 7
207
+ // case 6
213
208
{
214
209
endpoint : "https://download-actions-map.io" ,
215
210
expectederror : "" ,
216
211
},
217
- // case 8
212
+ // case 7
218
213
{
219
214
endpoint : "https://upload-actions-map.io" ,
220
- expectederror : "Missing action 'download'" ,
215
+ expectederror : "missing action 'download'" ,
221
216
},
222
- // case 9
217
+ // case 8
223
218
{
224
219
endpoint : "https://verify-actions-map.io" ,
225
- expectederror : "Missing action 'download'" ,
220
+ expectederror : "missing action 'download'" ,
226
221
},
227
- // case 10
222
+ // case 9
228
223
{
229
224
endpoint : "https://unknown-actions-map.io" ,
230
- expectederror : "Missing action 'download'" ,
225
+ expectederror : "missing action 'download'" ,
231
226
},
232
227
}
233
228
234
229
for n , c := range cases {
235
230
client := & HTTPClient {
236
- client : hc ,
237
- endpoint : c .endpoint ,
238
- transfers : make (map [string ]TransferAdapter ),
231
+ client : hc ,
232
+ endpoint : c .endpoint ,
233
+ transfers : []string {"dummy" },
234
+ activeAdapter : dummy ,
239
235
}
240
- client .transfers ["dummy" ] = dummy
241
236
242
237
err := client .Download (context .Background (), []Pointer {p }, func (p Pointer , content io.ReadCloser , objectError error ) error {
243
238
if objectError != nil {
@@ -284,7 +279,7 @@ func TestHTTPClientUpload(t *testing.T) {
284
279
// case 0
285
280
{
286
281
endpoint : "https://status-not-ok.io" ,
287
- expectederror : "Unexpected server response: " ,
282
+ expectederror : ErrUnexpectedEOF . Error () ,
288
283
},
289
284
// case 1
290
285
{
@@ -302,49 +297,44 @@ func TestHTTPClientUpload(t *testing.T) {
302
297
expectederror : "" ,
303
298
},
304
299
// case 4
305
- {
306
- endpoint : "https://unknown-transfer-adapter.io" ,
307
- expectederror : "TransferAdapter not found: " ,
308
- },
309
- // case 5
310
300
{
311
301
endpoint : "https://error-in-response-objects.io" ,
312
302
expectederror : "Object not found" ,
313
303
},
314
- // case 6
304
+ // case 5
315
305
{
316
306
endpoint : "https://empty-actions-map.io" ,
317
307
expectederror : "" ,
318
308
},
319
- // case 7
309
+ // case 6
320
310
{
321
311
endpoint : "https://download-actions-map.io" ,
322
- expectederror : "Missing action 'upload'" ,
312
+ expectederror : "missing action 'upload'" ,
323
313
},
324
- // case 8
314
+ // case 7
325
315
{
326
316
endpoint : "https://upload-actions-map.io" ,
327
317
expectederror : "" ,
328
318
},
329
- // case 9
319
+ // case 8
330
320
{
331
321
endpoint : "https://verify-actions-map.io" ,
332
- expectederror : "Missing action 'upload'" ,
322
+ expectederror : "missing action 'upload'" ,
333
323
},
334
- // case 10
324
+ // case 9
335
325
{
336
326
endpoint : "https://unknown-actions-map.io" ,
337
- expectederror : "Missing action 'upload'" ,
327
+ expectederror : "missing action 'upload'" ,
338
328
},
339
329
}
340
330
341
331
for n , c := range cases {
342
332
client := & HTTPClient {
343
- client : hc ,
344
- endpoint : c .endpoint ,
345
- transfers : make (map [string ]TransferAdapter ),
333
+ client : hc ,
334
+ endpoint : c .endpoint ,
335
+ transfers : []string {"dummy" },
336
+ activeAdapter : dummy ,
346
337
}
347
- client .transfers ["dummy" ] = dummy
348
338
349
339
err := client .Upload (context .Background (), []Pointer {p }, func (p Pointer , objectError error ) (io.ReadCloser , error ) {
350
340
return io .NopCloser (new (bytes.Buffer )), objectError
0 commit comments