Skip to content

Fix wrong status code returning in case of handler with middleware.Timeout throws the panic - #1864

Merged
aldas merged 1 commit into
labstack:masterfrom
Bl1tz23:master
May 8, 2021
Merged

aldas merged 1 commit into
labstack:masterfrom
Bl1tz23:master

Conversation

@Bl1tz23

@Bl1tz23 Bl1tz23 commented Apr 28, 2021

Copy link
Copy Markdown
Contributor

I found out that when the echo.HandlerFunc with middleware.Timeout calls panic, global middleware.Recover() could return a wrong status code to the client, cause inside echoHandlerFuncWrapper.ServeHTTP method the originalWriter wasn't restored if handler throws the panic.
This pull request must fix this issue.

@codecov

codecov Bot commented May 8, 2021

Copy link
Copy Markdown

Codecov Report

Merging #1864 (48fa624) into master (6430665) will increase coverage by 0.61%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1864      +/-   ##
==========================================
+ Coverage   89.57%   90.19%   +0.61%     
==========================================
  Files          31       31              
  Lines        2735     2765      +30     
==========================================
+ Hits         2450     2494      +44     
+ Misses        184      173      -11     
+ Partials      101       98       -3     
Impacted Files Coverage Δ
middleware/timeout.go 100.00% <100.00%> (ø)
middleware/jwt.go 79.80% <0.00%> (+1.91%) ⬆️
middleware/static.go 70.00% <0.00%> (+2.83%) ⬆️
middleware/key_auth.go 96.55% <0.00%> (+29.88%) ⬆️

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 6430665...48fa624. Read the comment docs.

@aldas
aldas merged commit 2943a32 into labstack:master May 8, 2021
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.

2 participants