Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix the gci lint issue in testutil #21695

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions testutil/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func GetRequestWithHeaders(url string, headers map[string]string) ([]byte, error
// GetRequest defines a wrapper around an HTTP GET request with a provided URL.
// An error is returned if the request or reading the body fails.
func GetRequest(url string) ([]byte, error) {
res, err := http.Get(url)
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer func() {
_ = res.Body.Close()
_ = resp.Body.Close()
}()

body, err := io.ReadAll(res.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
Expand All @@ -61,15 +61,15 @@ func GetRequest(url string) ([]byte, error) {
// PostRequest defines a wrapper around an HTTP POST request with a provided URL and data.
// An error is returned if the request or reading the body fails.
func PostRequest(url, contentType string, data []byte) ([]byte, error) {
res, err := http.Post(url, contentType, bytes.NewBuffer(data))
resp, err := http.Post(url, contentType, bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("error while sending post request: %w", err)
}
defer func() {
_ = res.Body.Close()
_ = resp.Body.Close()
}()

bz, err := io.ReadAll(res.Body)
bz, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("error reading response body: %w", err)
}
Expand Down
Loading