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

feat: expose http response headers in ServerError #100

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

karel-rehor
Copy link
Contributor

@karel-rehor karel-rehor commented Sep 4, 2024

Proposed Changes

  • Add http.Header to ServerError
  • Add tests of this change
  • Add examples of accessing response headers on write fail.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.28%. Comparing base (ece5518) to head (b3c49c7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
+ Coverage   85.25%   85.28%   +0.02%     
==========================================
  Files          14       14              
  Lines        1119     1121       +2     
==========================================
+ Hits          954      956       +2     
  Misses        137      137              
  Partials       28       28              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 762 to 764
assert.NotPanics(t, func() {
errors.As(err, &serr)
})
Copy link
Contributor

@alespour alespour Sep 5, 2024

Choose a reason for hiding this comment

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

I think it is safe to assume a correct pointer to As is passed since it's declared just before it, I would just make sure it's the correct target type, ie.

Suggested change
assert.NotPanics(t, func() {
errors.As(err, &serr)
})
require.True(t, errors.As(err, &serr))

And check return value of errors.As in examples too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed, however linter wants to enforce this solution:

require.ErrorAs(t, err, &serr)

So, used the linter suggestion.

Copy link
Contributor

@alespour alespour left a comment

Choose a reason for hiding this comment

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

LGTM now.

Copy link
Member

@bednar bednar left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@karel-rehor karel-rehor merged commit eab0a49 into main Sep 9, 2024
11 checks passed
@karel-rehor karel-rehor deleted the feat/HttpErrorHeaders branch September 9, 2024 11:37
@bednar bednar added this to the 0.10.0 milestone Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants