2019-11-02 21:32:58 +07:00
|
|
|
package suites
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
2019-11-25 03:27:59 +07:00
|
|
|
"testing"
|
2019-11-02 21:32:58 +07:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2019-11-25 03:27:59 +07:00
|
|
|
func doHTTPGetQuery(t *testing.T, url string) []byte {
|
|
|
|
client := NewHTTPClient()
|
2019-11-02 21:32:58 +07:00
|
|
|
req, err := http.NewRequest("GET", url, nil)
|
2019-11-25 03:27:59 +07:00
|
|
|
assert.NoError(t, err)
|
2019-11-02 21:32:58 +07:00
|
|
|
|
|
|
|
req.Header.Add("Accept", "application/json")
|
|
|
|
resp, err := client.Do(req)
|
2019-11-25 03:27:59 +07:00
|
|
|
assert.NoError(t, err)
|
2019-11-02 21:32:58 +07:00
|
|
|
|
|
|
|
defer resp.Body.Close()
|
|
|
|
body, _ := ioutil.ReadAll(resp.Body)
|
|
|
|
return body
|
|
|
|
}
|