Skip to content

Commit

Permalink
Replace ioutil.ReadAll with io.ReadAll
Browse files Browse the repository at this point in the history
  • Loading branch information
waybackarchiver committed Mar 18, 2023
1 parent fe52b1f commit e1024fa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions publish/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package github // import "github.com/wabarc/wayback/publish/github"
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"strings"
Expand All @@ -33,7 +33,7 @@ func TestToIssues(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
switch r.URL.Path {
case "/repos/bar/zoo/issues":
body, _ := ioutil.ReadAll(r.Body)
body, _ := io.ReadAll(r.Body)
if !strings.Contains(string(body), config.SlotName(config.SLOT_IA)) {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return
Expand Down
4 changes: 2 additions & 2 deletions publish/matrix/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package matrix // import "github.com/wabarc/wayback/publish/matrix"

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -36,7 +36,7 @@ func TestToMatrixRoom(t *testing.T) {
case r.URL.Path == "/_matrix/client/r0/login", r.URL.Path == "/_matrix/client/v3/login":
fmt.Fprintln(w, `{"access_token": "zoo"}`)
case strings.Contains(r.URL.Path, "!bar:example.com/send/m.room.message"):
body, _ := ioutil.ReadAll(r.Body)
body, _ := io.ReadAll(r.Body)
if !strings.Contains(string(body), config.SlotName(config.SLOT_IA)) {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return
Expand Down
4 changes: 2 additions & 2 deletions publish/meili/meili_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package meili // import "github.com/wabarc/wayback/publish/meili"
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -109,7 +109,7 @@ var (
w.WriteHeader(http.StatusAccepted)
_, _ = w.Write([]byte(respCreateIndex))
case r.Method == http.MethodPost && r.URL.Path == fmt.Sprintf(`/indexes/%s/documents`, indexing): // add documents
buf, err := ioutil.ReadAll(r.Body)
buf, err := io.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
_, _ = w.Write([]byte(respInvalidRequest))
Expand Down
4 changes: 2 additions & 2 deletions publish/notion/notion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package notion // import "github.com/wabarc/wayback/publish/notion"
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestToNotion(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
switch r.URL.Path {
case "/v1/pages":
body, _ := ioutil.ReadAll(r.Body)
body, _ := io.ReadAll(r.Body)
if !strings.Contains(string(body), config.SlotName(config.SLOT_IA)) {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return
Expand Down
4 changes: 2 additions & 2 deletions service/httpd/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package httpd // import "github.com/wabarc/wayback/service/httpd"
import (
"context"
"encoding/json"
"io/ioutil"
"io"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestProcessContentType(t *testing.T) {
if resp.StatusCode != test.status {
t.Fatalf("Unexpected response code got %d instead of %d", resp.StatusCode, test.status)
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatalf("Unexpected read body: %v", err)
}
Expand Down

0 comments on commit e1024fa

Please sign in to comment.