Skip to content

Commit

Permalink
fix: update practices from deprecated ioutil to os #4620 (#4622)
Browse files Browse the repository at this point in the history
  • Loading branch information
OremGLG authored Nov 22, 2024
1 parent b7d4e62 commit 77ff031
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functions/helloworld/hello_http_system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package helloworld

import (
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -114,16 +114,17 @@ func TestHelloHTTPSystem(t *testing.T) {
for _, test := range tests {
req := &http.Request{
Method: http.MethodPost,
Body: ioutil.NopCloser(strings.NewReader(test.body)),
Body: io.NopCloser(strings.NewReader(test.body)),
URL: testURL,
}
resp, err := client.Do(req)
if err != nil {
t.Fatalf("HelloHTTP http.Get: %v", err)
}
body, err := ioutil.ReadAll(resp.Body)

body, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatalf("HelloHTTP ioutil.ReadAll: %v", err)
t.Fatalf("HelloHTTP io.ReadAll: %v", err)
}
if got := string(body); got != test.want {
t.Errorf("HelloHTTP(%q) = %q, want %q", test.body, got, test.want)
Expand Down

0 comments on commit 77ff031

Please sign in to comment.