1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-09-19 18:53:43 +02:00

Replace uses of ioutil with io

This commit is contained in:
adnano 2021-02-28 21:38:36 -05:00
parent a11fe5f12d
commit c5dd17f286

View File

@ -2,7 +2,6 @@ package gemini
import ( import (
"io" "io"
"io/ioutil"
"strings" "strings"
"testing" "testing"
) )
@ -92,7 +91,7 @@ func TestReadWriteResponse(t *testing.T) {
for _, test := range tests { for _, test := range tests {
t.Logf("%#v", test.Raw) 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 { if err != test.Err {
t.Errorf("expected err = %v, got %v", test.Err, err) t.Errorf("expected err = %v, got %v", test.Err, err)
} }
@ -106,7 +105,7 @@ func TestReadWriteResponse(t *testing.T) {
if resp.Meta != test.Meta { if resp.Meta != test.Meta {
t.Errorf("expected meta = %s, got %s", test.Meta, resp.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) body := string(b)
if body != test.Body { if body != test.Body {
t.Errorf("expected body = %#v, got %#v", test.Body, body) t.Errorf("expected body = %#v, got %#v", test.Body, body)