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

Properly set Error.StatusCode #157

Merged
merged 2 commits into from
Apr 23, 2020
Merged

Properly set Error.StatusCode #157

merged 2 commits into from
Apr 23, 2020

Conversation

gernest
Copy link
Contributor

@gernest gernest commented Apr 23, 2020

fixes #154

newError was completely ignoring response status code.
It was wrongly deriving it from error code.

This patch ensures Error,StatusCode is set with correct response status.

fixes #154

newError was completely ingoring  response status code.
It was wrongly deriving it from error code.

This patch ensures Error,StatusCode is set with correct response status.
@gernest gernest requested a review from tcard April 23, 2020 13:54
@@ -54,3 +59,83 @@ func TestIssue127ErrorResponse(t *testing.T) {
assert.NotNil(t, err)
assert.Contains(t, err.Error(), errMsg)
}

func TestIssue_154(t *testing.T) {
Copy link
Contributor

@tcard tcard Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests a number of things that have nothing to do with #154. We just want to check that a HTTP response with 400 status code and non-JSON or MsgPack body turns into an ErrorInfo with 400 status code.

There are other tests that test retries and fallbacks.

@gernest
Copy link
Contributor Author

gernest commented Apr 23, 2020

@tcard PTAL I added a simpler test where I only check to see the StatusCode is properly set in Error on not json/msgpack mime types.

@gernest gernest merged commit b5536eb into master Apr 23, 2020
@gernest gernest deleted the fix-issue-154 branch April 23, 2020 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Lib failing to retrying on 5xx if it can't parse the body
2 participants