blob: 8aeeb7773e9eef0dab21596790cabf0b1ab91125 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package test
import (
"context"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/require"
)
var client *http.Client = &http.Client{
Timeout: 5 * time.Second,
}
func HttpGet(t *testing.T, ctx context.Context, path string) *http.Response {
request, err := http.NewRequestWithContext(ctx, http.MethodGet, path, nil)
require.NoError(t, err)
response, err := client.Do(request)
require.NoError(t, err)
return response
}
|