mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 16:34:30 +01:00
Improve output of --dump-headers
This commit is contained in:
parent
95fd79faf9
commit
b4d7741611
@ -8,7 +8,10 @@ import (
|
|||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
)
|
)
|
||||||
|
|
||||||
const separator = "------------------------------------------------------------"
|
const (
|
||||||
|
separatorReq = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||||
|
separatorResp = "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
|
||||||
|
)
|
||||||
|
|
||||||
// LoggedTransport is an http transport which logs the traffic
|
// LoggedTransport is an http transport which logs the traffic
|
||||||
type LoggedTransport struct {
|
type LoggedTransport struct {
|
||||||
@ -39,16 +42,16 @@ func (t *LoggedTransport) CancelRequest(req *http.Request) {
|
|||||||
|
|
||||||
// RoundTrip implements the RoundTripper interface.
|
// RoundTrip implements the RoundTripper interface.
|
||||||
func (t *LoggedTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
|
func (t *LoggedTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
|
||||||
buf, _ := httputil.DumpRequest(req, t.logBody)
|
buf, _ := httputil.DumpRequestOut(req, t.logBody)
|
||||||
log.Println(separator)
|
log.Println(separatorReq)
|
||||||
log.Println("HTTP REQUEST")
|
log.Println("HTTP REQUEST")
|
||||||
log.Println(string(buf))
|
log.Println(string(buf))
|
||||||
log.Println(separator)
|
log.Println(separatorReq)
|
||||||
resp, err = t.wrapped.RoundTrip(req)
|
resp, err = t.wrapped.RoundTrip(req)
|
||||||
buf, _ = httputil.DumpResponse(resp, t.logBody)
|
buf, _ = httputil.DumpResponse(resp, t.logBody)
|
||||||
log.Println(separator)
|
log.Println(separatorResp)
|
||||||
log.Println("HTTP RESPONSE")
|
log.Println("HTTP RESPONSE")
|
||||||
log.Println(string(buf))
|
log.Println(string(buf))
|
||||||
log.Println(separator)
|
log.Println(separatorResp)
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user