Codebase list golang-github-go-kit-kit / 84ef3c6
transport/http: moved ClientResponseFunc calls after the error check but before decoding Geoff Berger 7 years ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
9393 }
9494
9595 resp, err := ctxhttp.Do(ctx, c.client, req)
96 for _, f := range c.after {
97 ctx = f(ctx, resp)
98 }
99
10096 if err != nil {
10197 return nil, Error{Domain: DomainDo, Err: err}
10298 }
10399 if !c.bufferedStream {
104100 defer resp.Body.Close()
101 }
102
103 for _, f := range c.after {
104 ctx = f(ctx, resp)
105105 }
106106
107107 response, err := c.dec(ctx, resp)
1818
1919 // ClientResponseFunc may take information from an HTTP request and make the
2020 // response available for consumption. ClientResponseFuncs are only executed in
21 // clients, immediately after a request has been made.
21 // clients, after a request has been made, but prior to it being decoded.
2222 type ClientResponseFunc func(context.Context, *http.Response) context.Context
2323
2424 // SetContentType returns a ResponseFunc that sets the Content-Type header to