From 7a1a33513af58d6d957157759850bdba64c50bad Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Wed, 28 Oct 2020 00:21:27 -0400 Subject: [PATCH] Store a reference to the Request in Response --- client.go | 1 + response.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/client.go b/client.go index 823fa05..4b049e5 100644 --- a/client.go +++ b/client.go @@ -156,6 +156,7 @@ func (c *Client) do(req *Request, via []*Request) (*Response, error) { } } + resp.Request = req return resp, nil } diff --git a/response.go b/response.go index 4db127c..4b207e5 100644 --- a/response.go +++ b/response.go @@ -21,6 +21,9 @@ type Response struct { // Body contains the response body for successful responses. Body io.ReadCloser + // Request is the request that was sent to obtain this Response. + Request *Request + // TLS contains information about the TLS connection on which the response // was received. TLS tls.ConnectionState