Skip to content

Commit

Permalink
Merge pull request #46 from ozontech/issue-45
Browse files Browse the repository at this point in the history
[ISSUE-45] Fix bug with http.DefaultClient
  • Loading branch information
siller174 authored Nov 14, 2023
2 parents ab98a80 + 647aef9 commit cbfc834
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,16 @@ func (it *Test) doRequest(t T, baseReq *http.Request) (*http.Response, error) {
return nil, err
}

resp, err := it.httpClient.Do(req)

// Add information (method, host, curl) about request to Allure step
// should be after httpClient.Do, because in roundtripper request could be changed
err = addInformationRequest(t, req)
if err != nil {

Check failure on line 71 in roundtripper.go

View workflow job for this annotation

GitHub Actions / golangci-lint

block should not start with a whitespace (wsl)

return nil, err
}

resp, err := it.httpClient.Do(req)
if err != nil {

Check failure on line 76 in roundtripper.go

View workflow job for this annotation

GitHub Actions / golangci-lint

block should not start with a whitespace (wsl)

return nil, err
Expand Down
7 changes: 5 additions & 2 deletions test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,26 @@ func (it *Test) clearFields() {
}

func (it *Test) initEmptyFields() {
it.httpClient = http.DefaultClient

if it.AllureStep == nil {
it.AllureStep = new(AllureStep)
}

if it.Middleware == nil {
it.Middleware = new(Middleware)
}

if it.Expect == nil {
it.Expect = new(Expect)
}

if it.Request == nil {
it.Request = new(Request)
}

if it.Request.Repeat == nil {
it.Request.Repeat = new(RequestRepeatPolitic)
}

if it.Expect.JSONSchema == nil {
it.Expect.JSONSchema = new(ExpectJSONSchema)
}
Expand Down

0 comments on commit cbfc834

Please sign in to comment.