Skip to content

Commit

Permalink
refactor : no use ioutil
Browse files Browse the repository at this point in the history
Signed-off-by: yamasaki <yamasakipann0218@gmail.com>
  • Loading branch information
seipan authored and dghubble committed Jun 25, 2023
1 parent 2d5dbf9 commit 2fcef33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions sling.go
Expand Up @@ -3,7 +3,6 @@ package sling
import (
"encoding/base64"
"io"
"io/ioutil"
"net/http"
"net/url"

Expand Down Expand Up @@ -390,7 +389,7 @@ func (s *Sling) Do(req *http.Request, successV, failureV interface{}) (*http.Res
// reuse HTTP/1.x "keep-alive" TCP connections if the Body is
// not read to completion and closed.
// See: https://golang.org/pkg/net/http/#Response
defer io.Copy(ioutil.Discard, resp.Body)
defer io.Copy(io.Discard, resp.Body)

// Don't try to decode on 204s or Content-Length is 0
if resp.StatusCode == http.StatusNoContent || resp.ContentLength == 0 {
Expand Down
3 changes: 1 addition & 2 deletions sling_test.go
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"net"
"net/http"
Expand Down Expand Up @@ -385,7 +384,7 @@ func TestBodyFormSetter(t *testing.T) {
}

func TestBodySetter(t *testing.T) {
fakeInput := ioutil.NopCloser(strings.NewReader("test"))
fakeInput := io.NopCloser(strings.NewReader("test"))
fakeBodyProvider := bodyProvider{body: fakeInput}

cases := []struct {
Expand Down

0 comments on commit 2fcef33

Please sign in to comment.