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

return first if response is already committed in DefaultHTTPErrorHandler #1956

Merged

Conversation

mdaliyan
Copy link

I saw DefaultHTTPErrorHandler prepares an error response map and then discards everything if the response was already committed.

It can return earlier and do nothing if the response was already committed.

More readable and one less nesting.

@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #1956 (d27ec40) into master (499097e) will increase coverage by 0.03%.
The diff coverage is 37.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1956      +/-   ##
==========================================
+ Coverage   90.99%   91.03%   +0.03%     
==========================================
  Files          32       32              
  Lines        2799     2800       +1     
==========================================
+ Hits         2547     2549       +2     
+ Misses        161      160       -1     
  Partials       91       91              
Impacted Files Coverage Δ
echo.go 94.15% <37.50%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 499097e...d27ec40. Read the comment docs.

@mdaliyan mdaliyan force-pushed the return_first_if_response_is_already_committed branch 2 times, most recently from e25457b to 4b85e41 Compare August 12, 2021 10:33
@mdaliyan
Copy link
Author

mdaliyan commented Aug 12, 2021

There's no change in the DefaultHTTPErrorHandler function behavior. Newly added tests will pass in the master branch and this branch both.

ps: the coverage is now higher than before. I don't know how to tell Codecov to refresh the report.

@mdaliyan mdaliyan force-pushed the return_first_if_response_is_already_committed branch from fcb0790 to d27ec40 Compare August 12, 2021 10:56
@aldas
Copy link
Contributor

aldas commented Aug 12, 2021

LGTM

@aldas aldas merged commit 7d41537 into labstack:master Aug 12, 2021
@mdaliyan mdaliyan deleted the return_first_if_response_is_already_committed branch August 13, 2021 00:54
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.

None yet

2 participants