full diff: - api: https://github.com/moby/moby/compare/api/v1.52.0...api/v1.53.0 - client: https://github.com/moby/moby/compare/client/v0.2.1...client/v0.2.2 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
24 lines
352 B
Go
24 lines
352 B
Go
package client
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
type responseHookTransport struct {
|
|
base http.RoundTripper
|
|
hooks []ResponseHook
|
|
}
|
|
|
|
func (t *responseHookTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
resp, err := t.base.RoundTrip(req)
|
|
if err != nil {
|
|
return resp, err
|
|
}
|
|
|
|
for _, h := range t.hooks {
|
|
h(resp)
|
|
}
|
|
|
|
return resp, nil
|
|
}
|