@@ -3,7 +3,7 @@ package eppoclient
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
- "io/ioutil "
6
+ "io"
7
7
"net/http"
8
8
"net/http/httptest"
9
9
"os"
@@ -62,7 +62,10 @@ func initFixture() string {
62
62
server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
63
63
switch strings .TrimSpace (r .URL .Path ) {
64
64
case "/randomized_assignment/v3/config" :
65
- json .NewEncoder (w ).Encode (testResponse )
65
+ err := json .NewEncoder (w ).Encode (testResponse )
66
+ if err != nil {
67
+ fmt .Println ("Error encoding test response" )
68
+ }
66
69
default :
67
70
http .NotFoundHandler ().ServeHTTP (w , r )
68
71
}
@@ -72,7 +75,7 @@ func initFixture() string {
72
75
}
73
76
74
77
func getTestData () dictionary {
75
- files , err := ioutil .ReadDir (TEST_DATA_DIR )
78
+ files , err := os .ReadDir (TEST_DATA_DIR )
76
79
77
80
if err != nil {
78
81
panic ("test cases files read error" )
@@ -88,15 +91,22 @@ func getTestData() dictionary {
88
91
defer jsonFile .Close ()
89
92
90
93
testCaseDict := testData {}
91
- byteValue , _ := ioutil .ReadAll (jsonFile )
92
- json .Unmarshal (byteValue , & testCaseDict )
94
+ byteValue , _ := io .ReadAll (jsonFile )
95
+ err = json .Unmarshal (byteValue , & testCaseDict )
96
+ if err != nil {
97
+ fmt .Println ("Error reading test case file" )
98
+ }
93
99
tstData = append (tstData , testCaseDict )
94
100
}
95
101
96
102
var racResponseData map [string ]interface {}
97
103
racResponseJsonFile , _ := os .Open (MOCK_RAC_RESPONSE_FILE )
98
- byteValue , _ := ioutil .ReadAll (racResponseJsonFile )
104
+ byteValue , _ := io .ReadAll (racResponseJsonFile )
99
105
err = json .Unmarshal (byteValue , & racResponseData )
106
+ if err != nil {
107
+ fmt .Println ("Error reading mock RAC response file" )
108
+ }
109
+
100
110
if err != nil {
101
111
fmt .Println ("Error reading mock RAC response file" )
102
112
}
0 commit comments