Update dependency go modules for k8s v1.26.0-rc.0
This commit is contained in:
20
vendor/k8s.io/client-go/rest/request.go
generated
vendored
20
vendor/k8s.io/client-go/rest/request.go
generated
vendored
@@ -22,10 +22,10 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"strconv"
|
||||
@@ -437,7 +437,7 @@ func (r *Request) Body(obj interface{}) *Request {
|
||||
}
|
||||
switch t := obj.(type) {
|
||||
case string:
|
||||
data, err := ioutil.ReadFile(t)
|
||||
data, err := os.ReadFile(t)
|
||||
if err != nil {
|
||||
r.err = err
|
||||
return r
|
||||
@@ -826,7 +826,7 @@ func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error) {
|
||||
return nil, err
|
||||
}
|
||||
if r.body != nil {
|
||||
req.Body = ioutil.NopCloser(r.body)
|
||||
req.Body = io.NopCloser(r.body)
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
updateURLMetrics(ctx, r, resp, err)
|
||||
@@ -1018,7 +1018,7 @@ func (r *Request) Do(ctx context.Context) Result {
|
||||
func (r *Request) DoRaw(ctx context.Context) ([]byte, error) {
|
||||
var result Result
|
||||
err := r.request(ctx, func(req *http.Request, resp *http.Response) {
|
||||
result.body, result.err = ioutil.ReadAll(resp.Body)
|
||||
result.body, result.err = io.ReadAll(resp.Body)
|
||||
glogBody("Response Body", result.body)
|
||||
if resp.StatusCode < http.StatusOK || resp.StatusCode > http.StatusPartialContent {
|
||||
result.err = r.transformUnstructuredResponseError(resp, req, result.body)
|
||||
@@ -1037,7 +1037,7 @@ func (r *Request) DoRaw(ctx context.Context) ([]byte, error) {
|
||||
func (r *Request) transformResponse(resp *http.Response, req *http.Request) Result {
|
||||
var body []byte
|
||||
if resp.Body != nil {
|
||||
data, err := ioutil.ReadAll(resp.Body)
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
switch err.(type) {
|
||||
case nil:
|
||||
body = data
|
||||
@@ -1179,7 +1179,7 @@ const maxUnstructuredResponseTextBytes = 2048
|
||||
// TODO: introduce transformation of generic http.Client.Do() errors that separates 4.
|
||||
func (r *Request) transformUnstructuredResponseError(resp *http.Response, req *http.Request, body []byte) error {
|
||||
if body == nil && resp.Body != nil {
|
||||
if data, err := ioutil.ReadAll(&io.LimitedReader{R: resp.Body, N: maxUnstructuredResponseTextBytes}); err == nil {
|
||||
if data, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: maxUnstructuredResponseTextBytes}); err == nil {
|
||||
body = data
|
||||
}
|
||||
}
|
||||
@@ -1288,6 +1288,14 @@ func (r Result) StatusCode(statusCode *int) Result {
|
||||
return r
|
||||
}
|
||||
|
||||
// ContentType returns the "Content-Type" response header into the passed
|
||||
// string, returning the Result for possible chaining. (Only valid if no
|
||||
// error code was returned.)
|
||||
func (r Result) ContentType(contentType *string) Result {
|
||||
*contentType = r.contentType
|
||||
return r
|
||||
}
|
||||
|
||||
// Into stores the result into obj, if possible. If obj is nil it is ignored.
|
||||
// If the returned object is of type Status and has .Status != StatusSuccess, the
|
||||
// additional information in Status will be used to enrich the error.
|
||||
|
Reference in New Issue
Block a user