mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-16 05:16:08 +02:00
disable log application/octet-stream (#4997)
This commit is contained in:
parent
58616619bd
commit
8c79fcee36
@ -401,12 +401,13 @@ func (t *TransportWrapper) logRequest(req *http.Request) {
|
||||
log.Entry().Debugf("--> %v request to %v", req.Method, req.URL)
|
||||
log.Entry().Debugf("headers: %v", transformHeaders(req.Header))
|
||||
log.Entry().Debugf("cookies: %v", transformCookies(req.Cookies()))
|
||||
if t.doLogRequestBodyOnDebug && req.Body != nil {
|
||||
if t.doLogRequestBodyOnDebug && req.Header.Get("Content-Type") == "application/octet-stream" {
|
||||
// skip logging byte content as it's useless
|
||||
} else if t.doLogRequestBodyOnDebug && req.Body != nil {
|
||||
var buf bytes.Buffer
|
||||
tee := io.TeeReader(req.Body, &buf)
|
||||
log.Entry().Debugf("body: %v", transformBody(tee))
|
||||
req.Body = io.NopCloser(bytes.NewReader(buf.Bytes()))
|
||||
log.Entry().Debugf("body: %v", transformBody(tee))
|
||||
}
|
||||
log.Entry().Debug("--------------------------------")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user