authelia/internal/suites/action_http.go
James Elliott 7df242f1e3
refactor: remove ioutil (#2635)
Was deprecated in 1.16 and has more performant options available.
2021-12-02 00:14:15 +11:00

25 lines
424 B
Go

package suites
import (
"io"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func doHTTPGetQuery(t *testing.T, url string) []byte {
client := NewHTTPClient()
req, err := http.NewRequest("GET", url, nil)
assert.NoError(t, err)
req.Header.Add("Accept", "application/json")
resp, err := client.Do(req)
assert.NoError(t, err)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
return body
}