-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add the ability to change the status code using Response beforeFuncs #1706
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1706 +/- ##
==========================================
+ Coverage 84.88% 84.98% +0.10%
==========================================
Files 29 29
Lines 1945 1958 +13
==========================================
+ Hits 1651 1664 +13
Misses 187 187
Partials 107 107
Continue to review full report at Codecov.
|
Any reason for this change? |
Hi @iambenkay We need to change the status code of a request in some situations using the middleware. For example: e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
c.Response().Before(func() {
if 200 < c.Response().Status && c.Response().Status < 300 {
c.Response().Status = 200
}
})
return next(c)
}
}) |
okay I understand. so you need it set before the |
@RashadAnsari If we make this an intended behaviour, we should a test for it too, to ensure it stays that way. I will merge then. |
@lammel |
Thanks. That was fast ;-) |
No description provided.