transport/http: moved ClientResponseFunc calls after the error check but before decoding
Geoff Berger
7 years ago
93 | 93 |
}
|
94 | 94 |
|
95 | 95 |
resp, err := ctxhttp.Do(ctx, c.client, req)
|
96 | |
for _, f := range c.after {
|
97 | |
ctx = f(ctx, resp)
|
98 | |
}
|
99 | |
|
100 | 96 |
if err != nil {
|
101 | 97 |
return nil, Error{Domain: DomainDo, Err: err}
|
102 | 98 |
}
|
103 | 99 |
if !c.bufferedStream {
|
104 | 100 |
defer resp.Body.Close()
|
|
101 |
}
|
|
102 |
|
|
103 |
for _, f := range c.after {
|
|
104 |
ctx = f(ctx, resp)
|
105 | 105 |
}
|
106 | 106 |
|
107 | 107 |
response, err := c.dec(ctx, resp)
|
18 | 18 |
|
19 | 19 |
// ClientResponseFunc may take information from an HTTP request and make the
|
20 | 20 |
// 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.
|
22 | 22 |
type ClientResponseFunc func(context.Context, *http.Response) context.Context
|
23 | 23 |
|
24 | 24 |
// SetContentType returns a ResponseFunc that sets the Content-Type header to
|