Skip to content

Commit

Permalink
Fix incorrect response time at save response file
Browse files Browse the repository at this point in the history
  • Loading branch information
iwaltgen committed Jul 23, 2020
1 parent ca7661a commit 5d3915c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,11 @@ func (c *Client) execute(req *Request) (*Response, error) {
return response, err
}

response.setReceivedAt() // after we read the body
response.size = int64(len(response.body))
}

response.setReceivedAt() // after we read the body

// Apply Response middleware
for _, f := range c.afterResponse {
if err = f(c, response); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ func TestOutputFileWithBaseDirAndRelativePath(t *testing.T) {

assertError(t, err)
assertEqual(t, true, resp.Size() != 0)
assertEqual(t, true, resp.Time() > 0)
}

func TestOutputFileWithBaseDirError(t *testing.T) {
Expand All @@ -1336,6 +1337,7 @@ func TestOutputPathDirNotExists(t *testing.T) {

assertError(t, err)
assertEqual(t, true, resp.Size() != 0)
assertEqual(t, true, resp.Time() > 0)
}

func TestOutputFileAbsPath(t *testing.T) {
Expand Down

0 comments on commit 5d3915c

Please sign in to comment.