mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Pass error to Client.ResponseHook
This commit is contained in:
parent
0439180737
commit
78f5e4373b
1 changed files with 4 additions and 4 deletions
|
|
@ -65,7 +65,7 @@ type Client struct {
|
|||
Log zerolog.Logger
|
||||
|
||||
RequestHook func(req *http.Request)
|
||||
ResponseHook func(req *http.Request, resp *http.Response, duration time.Duration)
|
||||
ResponseHook func(req *http.Request, resp *http.Response, err error, duration time.Duration)
|
||||
|
||||
SyncPresence event.Presence
|
||||
|
||||
|
|
@ -291,10 +291,10 @@ func (cli *Client) LogRequestDone(req *http.Request, resp *http.Response, err er
|
|||
Str("method", req.Method).
|
||||
Str("url", req.URL.String()).
|
||||
Dur("duration", duration)
|
||||
if cli.ResponseHook != nil {
|
||||
cli.ResponseHook(req, resp, err, duration)
|
||||
}
|
||||
if resp != nil {
|
||||
if cli.ResponseHook != nil {
|
||||
cli.ResponseHook(req, resp, duration)
|
||||
}
|
||||
mime := resp.Header.Get("Content-Type")
|
||||
length := resp.ContentLength
|
||||
if length == -1 && contentLength > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue