2019-11-02 14:32:58 +00:00
|
|
|
package suites
|
|
|
|
|
|
|
|
import (
|
2021-12-01 13:14:15 +00:00
|
|
|
"io"
|
2019-11-02 14:32:58 +00:00
|
|
|
"net/http"
|
2019-11-24 20:27:59 +00:00
|
|
|
"testing"
|
2019-11-02 14:32:58 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-04-15 05:03:14 +00:00
|
|
|
"github.com/valyala/fasthttp"
|
2019-11-02 14:32:58 +00:00
|
|
|
)
|
|
|
|
|
2019-11-24 20:27:59 +00:00
|
|
|
func doHTTPGetQuery(t *testing.T, url string) []byte {
|
|
|
|
client := NewHTTPClient()
|
2023-04-15 05:03:14 +00:00
|
|
|
req, err := http.NewRequest(fasthttp.MethodGet, url, nil)
|
2019-11-24 20:27:59 +00:00
|
|
|
assert.NoError(t, err)
|
2019-11-02 14:32:58 +00:00
|
|
|
|
2023-04-15 05:03:14 +00:00
|
|
|
req.Header.Add(fasthttp.HeaderAccept, "application/json")
|
2019-11-02 14:32:58 +00:00
|
|
|
resp, err := client.Do(req)
|
2019-11-24 20:27:59 +00:00
|
|
|
assert.NoError(t, err)
|
2019-11-02 14:32:58 +00:00
|
|
|
|
|
|
|
defer resp.Body.Close()
|
2021-12-01 13:14:15 +00:00
|
|
|
body, _ := io.ReadAll(resp.Body)
|
2020-05-05 19:35:32 +00:00
|
|
|
|
2019-11-02 14:32:58 +00:00
|
|
|
return body
|
|
|
|
}
|