diff options
Diffstat (limited to 'tests/helper/http.go')
-rw-r--r-- | tests/helper/http.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/helper/http.go b/tests/helper/http.go new file mode 100644 index 000000000..b379695d0 --- /dev/null +++ b/tests/helper/http.go @@ -0,0 +1,24 @@ +package helper + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func CreateTests(uri string, value interface{}) error { + resp, err := http.Get(uri) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + data, err := ioutil.ReadAll(resp.Body) + + err = json.Unmarshal(data, &value) + if err != nil { + return err + } + + return nil +} |