-
Notifications
You must be signed in to change notification settings - Fork 166
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
Compatibility issues with the Echo framework #15
Comments
I try to remove if bw.code != 0 {
w.WriteHeader(bw.code)
}
_, err = w.Write(bw.buf.Bytes())
if err != nil {
m.opts.errorFunc(w, r, err)
} |
Again, I'm not too familiar with Echo but I think this was probably being caused by the fact that both SCS and Echo's The new version SCS (> 1.0.0) no longer calls The code below works for me and triggers a 500 status without any warnings: package main
import (
"errors"
"fmt"
"github.com/alexedwards/scs"
"github.com/labstack/echo"
)
var sessionManager = scs.NewCookieManager("u46IpCV9y5Vlur8YvODJEhgOY8m9JVE4")
func main() {
e := echo.New()
e.Use(echo.WrapMiddleware(sessionManager.Use))
e.HTTPErrorHandler = errorHandler
e.GET("/", func(c echo.Context) error {
c.Error(errors.New("test"))
return nil
})
e.Start(":4000")
}
func errorHandler(err error, ctx echo.Context) {
ctx.String(500, fmt.Sprintln(err))
} |
I use the
scs/session
package in Echo, and if I export anything to the browser in theHTTPErrorHandler
function of Echo, the Echo of logger will print such warning messages:Level:WARN, file:context.go, line:484, message:response, already, committed.
If I don't use session, there won't be such a problem.
The text was updated successfully, but these errors were encountered: