Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-73] fix error check in http do #74

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.21
require (
github.com/josephburnett/jd v1.7.1
github.com/ohler55/ojg v1.21.1
github.com/ozontech/allure-go/pkg/allure v0.6.13-0.20240320124242-dd7f2ab15350
github.com/ozontech/allure-go/pkg/framework v0.6.30-0.20240320124242-dd7f2ab15350
github.com/ozontech/allure-go/pkg/allure v0.6.13
github.com/ozontech/allure-go/pkg/framework v0.6.31
github.com/stretchr/testify v1.8.4
github.com/xeipuuv/gojsonschema v1.2.0
moul.io/http2curl/v2 v2.3.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/ohler55/ojg v1.21.1 h1:b2RLUaDcy9gvn46dmhTjezu/TDauoR0/kgKTqkwIxto=
github.com/ohler55/ojg v1.21.1/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o=
github.com/ozontech/allure-go/pkg/allure v0.6.13-0.20240320124242-dd7f2ab15350 h1:IBKoi5yMF3kINxJ5YWRCjitZm2n5jA6kq8qqZu1OmsA=
github.com/ozontech/allure-go/pkg/allure v0.6.13-0.20240320124242-dd7f2ab15350/go.mod h1:4oEG2yq+DGOzJS/ZjPc87C/mx3tAnlYpYonk77Ru/vQ=
github.com/ozontech/allure-go/pkg/framework v0.6.30-0.20240320124242-dd7f2ab15350 h1:QYE7DoTcAIKDd0BKe9epSK8j9bwOaQx0zS4zoGe7LlE=
github.com/ozontech/allure-go/pkg/framework v0.6.30-0.20240320124242-dd7f2ab15350/go.mod h1:ZNUnhean4TKmDwHPX2Jwr3y/o0WTeyuXB9aKKRcyHBg=
github.com/ozontech/allure-go/pkg/allure v0.6.13 h1:vkLSIvOEERHTxe+oq8DXDu/m+kLnVUkrXNN8xTKuKU4=
github.com/ozontech/allure-go/pkg/allure v0.6.13/go.mod h1:4oEG2yq+DGOzJS/ZjPc87C/mx3tAnlYpYonk77Ru/vQ=
github.com/ozontech/allure-go/pkg/framework v0.6.31 h1:u32AqB9/JkzcL5vSl8PSUmMZbsVTmoriDylI3FIYgX4=
github.com/ozontech/allure-go/pkg/framework v0.6.31/go.mod h1:wfqY4e4+w4BoRFDxHp7TNcdWfcCOWJV3BjrUqUughWY=
github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7/go.mod h1:zO8QMzTeZd5cpnIkz/Gn6iK0jDfGicM1nynOkkPIl28=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
8 changes: 8 additions & 0 deletions roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ func (it *Test) doRequest(t T, baseReq *http.Request) (*http.Response, error) {
}

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

// http client has case wheh it return response and error in one time
// we have to check this case
if resp == nil {
if httpErr != nil {
return nil, cuteErrors.NewCuteError("[HTTP] Could not do request", httpErr)
}

// if response is nil, we can't get information about request and response
return nil, cuteErrors.NewCuteError("[HTTP] Response is nil", httpErr)
}

Expand Down
Loading