mirror of
https://github.com/labstack/echo.git
synced 2025-11-27 22:38:25 +02:00
@@ -93,7 +93,7 @@ func TestGzipWithStatic(t *testing.T) {
|
||||
defer r.Close()
|
||||
want, err := ioutil.ReadFile("../_fixture/images/walle.png")
|
||||
if assert.NoError(t, err) {
|
||||
var buf bytes.Buffer
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(r)
|
||||
assert.Equal(t, want, buf.Bytes())
|
||||
}
|
||||
|
||||
@@ -124,8 +124,7 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
|
||||
|
||||
req := c.Request()
|
||||
k, err := c.Cookie(config.CookieName)
|
||||
|
||||
var token string
|
||||
token := ""
|
||||
|
||||
// Generate token
|
||||
if err != nil {
|
||||
@@ -144,7 +143,7 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
if !validateCSRFToken(token, clientToken) {
|
||||
return echo.NewHTTPError(http.StatusForbidden, "Invalid csrf token")
|
||||
return echo.NewHTTPError(http.StatusForbidden, "invalid csrf token")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ const (
|
||||
|
||||
// Errors
|
||||
var (
|
||||
ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "Missing or malformed jwt")
|
||||
ErrJWTInvalid = echo.NewHTTPError(http.StatusUnauthorized, "Invalid or expired jwt")
|
||||
ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt")
|
||||
ErrJWTInvalid = echo.NewHTTPError(http.StatusUnauthorized, "invalid or expired jwt")
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user