5
5
"context"
6
6
"errors"
7
7
"io"
8
- "io/ioutil"
9
8
"net/http"
10
9
"reflect"
11
10
"strings"
@@ -23,7 +22,7 @@ type eqReaderMatcher struct {
23
22
}
24
23
25
24
func eqReader (r io.Reader ) gomock.Matcher {
26
- allBytes , err := ioutil .ReadAll (r )
25
+ allBytes , err := io .ReadAll (r )
27
26
if err != nil {
28
27
panic (err )
29
28
}
@@ -35,7 +34,7 @@ func (m *eqReaderMatcher) Matches(x interface{}) bool {
35
34
return false
36
35
}
37
36
r := x .(io.Reader )
38
- allBytes , err := ioutil .ReadAll (r )
37
+ allBytes , err := io .ReadAll (r )
39
38
if err != nil {
40
39
panic (err )
41
40
}
@@ -66,7 +65,7 @@ func TestDocumentsImportWithOneDocument(t *testing.T) {
66
65
"companies" , expectedParams , "application/octet-stream" , eqReader (expectedBody )).
67
66
Return (& http.Response {
68
67
StatusCode : http .StatusOK ,
69
- Body : ioutil .NopCloser (strings .NewReader (expectedResultString )),
68
+ Body : io .NopCloser (strings .NewReader (expectedResultString )),
70
69
}, nil ).
71
70
Times (1 )
72
71
@@ -116,7 +115,7 @@ func TestDocumentsImportWithOneDocumentAndInvalidResultJsonReturnsError(t *testi
116
115
"companies" , expectedParams , "application/octet-stream" , eqReader (expectedBody )).
117
116
Return (& http.Response {
118
117
StatusCode : http .StatusOK ,
119
- Body : ioutil .NopCloser (strings .NewReader (expectedResultString )),
118
+ Body : io .NopCloser (strings .NewReader (expectedResultString )),
120
119
}, nil ).
121
120
Times (1 )
122
121
@@ -182,7 +181,7 @@ func TestDocumentsImportOnHttpStatusErrorCodeReturnsError(t *testing.T) {
182
181
"companies" , gomock .Any (), "application/octet-stream" , gomock .Any ()).
183
182
Return (& http.Response {
184
183
StatusCode : http .StatusInternalServerError ,
185
- Body : ioutil .NopCloser (strings .NewReader ("Internal server error" )),
184
+ Body : io .NopCloser (strings .NewReader ("Internal server error" )),
186
185
}, nil ).
187
186
Times (1 )
188
187
@@ -220,7 +219,7 @@ func TestDocumentsImportWithTwoDocuments(t *testing.T) {
220
219
"companies" , expectedParams , "application/octet-stream" , eqReader (expectedBody )).
221
220
Return (& http.Response {
222
221
StatusCode : http .StatusOK ,
223
- Body : ioutil .NopCloser (strings .NewReader (expectedResultString )),
222
+ Body : io .NopCloser (strings .NewReader (expectedResultString )),
224
223
}, nil ).
225
224
Times (1 )
226
225
@@ -254,7 +253,7 @@ func TestDocumentsImportWithActionOnly(t *testing.T) {
254
253
"companies" , expectedParams , "application/octet-stream" , gomock .Any ()).
255
254
Return (& http.Response {
256
255
StatusCode : http .StatusOK ,
257
- Body : ioutil .NopCloser (strings .NewReader (`{"success": true}` )),
256
+ Body : io .NopCloser (strings .NewReader (`{"success": true}` )),
258
257
}, nil ).
259
258
Times (1 )
260
259
@@ -284,7 +283,7 @@ func TestDocumentsImportWithBatchSizeOnly(t *testing.T) {
284
283
"companies" , expectedParams , "application/octet-stream" , gomock .Any ()).
285
284
Return (& http.Response {
286
285
StatusCode : http .StatusOK ,
287
- Body : ioutil .NopCloser (strings .NewReader (`{"success": true}` )),
286
+ Body : io .NopCloser (strings .NewReader (`{"success": true}` )),
288
287
}, nil ).
289
288
Times (1 )
290
289
@@ -316,7 +315,7 @@ func TestDocumentsImportJsonl(t *testing.T) {
316
315
"companies" , expectedParams , "application/octet-stream" , eqReader (expectedBody )).
317
316
Return (& http.Response {
318
317
StatusCode : http .StatusOK ,
319
- Body : ioutil .NopCloser (bytes .NewBuffer (expectedBytes )),
318
+ Body : io .NopCloser (bytes .NewBuffer (expectedBytes )),
320
319
}, nil ).
321
320
Times (1 )
322
321
@@ -329,7 +328,7 @@ func TestDocumentsImportJsonl(t *testing.T) {
329
328
result , err := client .Collection ("companies" ).Documents ().ImportJsonl (context .Background (), importBody , params )
330
329
assert .Nil (t , err )
331
330
332
- resultBytes , err := ioutil .ReadAll (result )
331
+ resultBytes , err := io .ReadAll (result )
333
332
assert .Nil (t , err )
334
333
assert .Equal (t , string (expectedBytes ), string (resultBytes ))
335
334
}
@@ -365,7 +364,7 @@ func TestDocumentsImportJsonlOnHttpStatusErrorCodeReturnsError(t *testing.T) {
365
364
gomock .Any (), gomock .Any (), "application/octet-stream" , gomock .Any ()).
366
365
Return (& http.Response {
367
366
StatusCode : http .StatusInternalServerError ,
368
- Body : ioutil .NopCloser (strings .NewReader ("Internal server error" )),
367
+ Body : io .NopCloser (strings .NewReader ("Internal server error" )),
369
368
}, nil ).
370
369
Times (1 )
371
370
@@ -394,7 +393,7 @@ func TestDocumentsImportJsonlWithActionOnly(t *testing.T) {
394
393
"companies" , expectedParams , "application/octet-stream" , gomock .Any ()).
395
394
Return (& http.Response {
396
395
StatusCode : http .StatusOK ,
397
- Body : ioutil .NopCloser (strings .NewReader (`{"success": true}` )),
396
+ Body : io .NopCloser (strings .NewReader (`{"success": true}` )),
398
397
}, nil ).
399
398
Times (1 )
400
399
@@ -422,7 +421,7 @@ func TestDocumentsImportJsonlWithBatchSizeOnly(t *testing.T) {
422
421
"companies" , expectedParams , "application/octet-stream" , gomock .Any ()).
423
422
Return (& http.Response {
424
423
StatusCode : http .StatusOK ,
425
- Body : ioutil .NopCloser (strings .NewReader (`{"success": true}` )),
424
+ Body : io .NopCloser (strings .NewReader (`{"success": true}` )),
426
425
}, nil ).
427
426
Times (1 )
428
427
0 commit comments