mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #28910 from rmmh/body-log
Automatic merge from submit-queue Log restclient request/response bodies using %#v. These are now protobufs, so outputting them with %s dumps a large amount of binary garbage into the log. %#v properly escapes exotic characters.
This commit is contained in:
commit
8f08cb3391
@ -538,10 +538,10 @@ func (r *Request) Body(obj interface{}) *Request {
|
|||||||
r.err = err
|
r.err = err
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
glog.V(8).Infof("Request Body: %s", string(data))
|
glog.V(8).Infof("Request Body: %#v", string(data))
|
||||||
r.body = bytes.NewReader(data)
|
r.body = bytes.NewReader(data)
|
||||||
case []byte:
|
case []byte:
|
||||||
glog.V(8).Infof("Request Body: %s", string(t))
|
glog.V(8).Infof("Request Body: %#v", string(t))
|
||||||
r.body = bytes.NewReader(t)
|
r.body = bytes.NewReader(t)
|
||||||
case io.Reader:
|
case io.Reader:
|
||||||
r.body = t
|
r.body = t
|
||||||
@ -555,7 +555,7 @@ func (r *Request) Body(obj interface{}) *Request {
|
|||||||
r.err = err
|
r.err = err
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
glog.V(8).Infof("Request Body: %s", string(data))
|
glog.V(8).Infof("Request Body: %#v", string(data))
|
||||||
r.body = bytes.NewReader(data)
|
r.body = bytes.NewReader(data)
|
||||||
r.SetHeader("Content-Type", r.content.ContentType)
|
r.SetHeader("Content-Type", r.content.ContentType)
|
||||||
default:
|
default:
|
||||||
@ -888,7 +888,7 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu
|
|||||||
body = data
|
body = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(8).Infof("Response Body: %s", string(body))
|
glog.V(8).Infof("Response Body: %#v", string(body))
|
||||||
|
|
||||||
// Did the server give us a status response?
|
// Did the server give us a status response?
|
||||||
isStatusResponse := false
|
isStatusResponse := false
|
||||||
@ -970,7 +970,7 @@ func (r *Request) transformUnstructuredResponseError(resp *http.Response, req *h
|
|||||||
body = data
|
body = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(8).Infof("Response Body: %s", string(body))
|
glog.V(8).Infof("Response Body: %#v", string(body))
|
||||||
|
|
||||||
message := "unknown"
|
message := "unknown"
|
||||||
if isTextResponse(resp) {
|
if isTextResponse(resp) {
|
||||||
|
Loading…
Reference in New Issue
Block a user