Replace uses of ioutil with io

This commit is contained in:
Adnan Maolood 2021-02-16 18:57:24 -05:00
parent d2001de5f3
commit 332dd253d0
2 changed files with 4 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import (
"crypto/x509"
"errors"
"fmt"
"io/ioutil"
"io"
"log"
"net/url"
"os"
@ -149,7 +149,7 @@ func main() {
// Handle response
if gemini.StatusClass(resp.Status) == gemini.StatusSuccess {
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}

View File

@ -2,7 +2,6 @@ package gemini
import (
"io"
"io/ioutil"
"strings"
"testing"
)
@ -81,7 +80,7 @@ func TestReadResponse(t *testing.T) {
for _, test := range tests {
t.Logf("%#v", test.Raw)
resp, err := ReadResponse(ioutil.NopCloser(strings.NewReader(test.Raw)))
resp, err := ReadResponse(io.NopCloser(strings.NewReader(test.Raw)))
if err != test.Err {
t.Errorf("expected err = %v, got %v", test.Err, err)
}
@ -95,7 +94,7 @@ func TestReadResponse(t *testing.T) {
if resp.Meta != test.Meta {
t.Errorf("expected meta = %s, got %s", test.Meta, resp.Meta)
}
b, _ := ioutil.ReadAll(resp.Body)
b, _ := io.ReadAll(resp.Body)
body := string(b)
if body != test.Body {
t.Errorf("expected body = %#v, got %#v", test.Body, body)