2019-11-02 21:32:58 +07:00
|
|
|
package suites
|
|
|
|
|
|
|
|
import (
|
2021-12-01 20:14:15 +07:00
|
|
|
"io"
|
2019-11-02 21:32:58 +07:00
|
|
|
"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()
|
2021-12-01 20:14:15 +07:00
|
|
|
body, _ := io.ReadAll(resp.Body)
|
2020-05-06 02:35:32 +07:00
|
|
|
|
2019-11-02 21:32:58 +07:00
|
|
|
return body
|
|
|
|
}
|