Skip to content

Commit

Permalink
Merge pull request #174 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
davecheney committed Oct 17, 2023
2 parents 2110a0a + ea8d457 commit 2e07844
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"mime"
"net"
Expand Down Expand Up @@ -150,7 +149,7 @@ func readClientCert(filename string) []tls.Certificate {
)

// read client certificate file (must include client private key and certificate)
certFileBytes, err := ioutil.ReadFile(filename)
certFileBytes, err := os.ReadFile(filename)
if err != nil {
log.Fatalf("failed to read client certificate file: %v", err)
}
Expand Down Expand Up @@ -452,7 +451,7 @@ func readResponseBody(req *http.Request, resp *http.Response) string {
return ""
}

w := ioutil.Discard
w := io.Discard
msg := color.CyanString("Body discarded")

if saveOutput || outputFile != "" {
Expand All @@ -479,7 +478,7 @@ func readResponseBody(req *http.Request, resp *http.Response) string {
msg = color.CyanString("Body read")
}

if _, err := io.Copy(w, resp.Body); err != nil && w != ioutil.Discard {
if _, err := io.Copy(w, resp.Body); err != nil && w != io.Discard {
log.Fatalf("failed to read response body: %v", err)
}

Expand Down

0 comments on commit 2e07844

Please sign in to comment.