refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@@ -101,7 +101,7 @@ func TestHandleDeviceCode(t *testing.T) {
|
||||
t.Errorf("Unexpected Response Type. Expected %v got %v", tc.expectedResponseCode, rr.Code)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(rr.Body)
|
||||
body, err := io.ReadAll(rr.Body)
|
||||
if err != nil {
|
||||
t.Errorf("Could read token response %v", err)
|
||||
}
|
||||
@@ -541,7 +541,7 @@ func TestDeviceTokenResponse(t *testing.T) {
|
||||
t.Errorf("Unexpected Response Type. Expected %v got %v", tc.expectedResponseCode, rr.Code)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(rr.Body)
|
||||
body, err := io.ReadAll(rr.Body)
|
||||
if err != nil {
|
||||
t.Errorf("Could read token response %v", err)
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/http/httputil"
|
||||
@@ -1588,7 +1588,7 @@ func TestOAuth2DeviceFlow(t *testing.T) {
|
||||
t.Errorf("Could not request device code: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
responseBody, err := ioutil.ReadAll(resp.Body)
|
||||
responseBody, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("Could read device code response %v", err)
|
||||
}
|
||||
@@ -1615,7 +1615,7 @@ func TestOAuth2DeviceFlow(t *testing.T) {
|
||||
t.Errorf("Error Posting Form: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
responseBody, err = ioutil.ReadAll(resp.Body)
|
||||
responseBody, err = io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("Could read verification response %v", err)
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ func TestOAuth2DeviceFlow(t *testing.T) {
|
||||
t.Errorf("Could not request device token: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
responseBody, err = ioutil.ReadAll(resp.Body)
|
||||
responseBody, err = io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("Could read device token response %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user