Ran `make update-dependencies`

https://mattermost.atlassian.net/browse/MM-32961
Этот коммит содержится в:
Agniva De Sarker
2021-03-09 11:26:42 +05:30
коммит произвёл GitHub
родитель 9858413ed2
Коммит 91099818df
696 изменённых файлов: 19751 добавлений и 6505 удалений

58
vendor/github.com/getsentry/sentry-go/internal/debug/transport.go сгенерированный поставляемый
Просмотреть файл

@@ -1,38 +1,72 @@
package debug
import (
"bytes"
"fmt"
"io"
"net/http"
"net/http/httptrace"
"net/http/httputil"
)
// Transport implements http.RoundTripper and can be used to wrap other HTTP
// transports to dump request and responses for debugging.
// transports for debugging, normally http.DefaultTransport.
type Transport struct {
http.RoundTripper
Output io.Writer
// Dump controls whether to dump HTTP request and responses.
Dump bool
// Trace enables usage of net/http/httptrace.
Trace bool
}
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
b, err := httputil.DumpRequestOut(req, true)
if err != nil {
return nil, err
var buf bytes.Buffer
if t.Dump {
b, err := httputil.DumpRequestOut(req, true)
if err != nil {
panic(err)
}
_, err = buf.Write(ensureTrailingNewline(b))
if err != nil {
panic(err)
}
}
_, err = t.Output.Write(ensureTrailingNewline(b))
if err != nil {
return nil, err
if t.Trace {
trace := &httptrace.ClientTrace{
DNSDone: func(di httptrace.DNSDoneInfo) {
fmt.Fprintf(&buf, "* DNS %v → %v\n", req.Host, di.Addrs)
},
GotConn: func(ci httptrace.GotConnInfo) {
fmt.Fprintf(&buf, "* Connection local=%v remote=%v", ci.Conn.LocalAddr(), ci.Conn.RemoteAddr())
if ci.Reused {
fmt.Fprint(&buf, " (reused)")
}
if ci.WasIdle {
fmt.Fprintf(&buf, " (idle %v)", ci.IdleTime)
}
fmt.Fprintln(&buf)
},
}
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
}
resp, err := t.RoundTripper.RoundTrip(req)
if err != nil {
return nil, err
}
b, err = httputil.DumpResponse(resp, true)
if err != nil {
return nil, err
if t.Dump {
b, err := httputil.DumpResponse(resp, true)
if err != nil {
panic(err)
}
_, err = buf.Write(ensureTrailingNewline(b))
if err != nil {
panic(err)
}
}
_, err = t.Output.Write(ensureTrailingNewline(b))
_, err = io.Copy(t.Output, &buf)
if err != nil {
return nil, err
panic(err)
}
return resp, nil
}