NewResponse returns a new Response instance. If reporter is nil, the function panics. If response is nil, failure is reported. If rtt is given, it defines response round-trip time to be reported by response.RoundTripTime().
( reporter Reporter, response *http.Response, rtt ...time.Duration, )
| 56 | // If rtt is given, it defines response round-trip time to be reported |
| 57 | // by response.RoundTripTime(). |
| 58 | func NewResponse( |
| 59 | reporter Reporter, response *http.Response, rtt ...time.Duration, |
| 60 | ) *Response { |
| 61 | config := Config{Reporter: reporter} |
| 62 | config = config.withDefaults() |
| 63 | |
| 64 | return newResponse(responseOpts{ |
| 65 | config: config, |
| 66 | chain: newChainWithConfig("Response()", config), |
| 67 | httpResp: response, |
| 68 | rtt: rtt, |
| 69 | }) |
| 70 | } |
| 71 | |
| 72 | // NewResponse returns a new Response instance with config. |
| 73 | // |
searching dependent graphs…