mirror of
https://github.com/labstack/echo.git
synced 2025-07-15 01:34:53 +02:00
Using random string from gommon
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/test"
|
||||
"github.com/labstack/gommon/random"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@ -41,7 +42,7 @@ func TestCSRF(t *testing.T) {
|
||||
assert.Error(t, h(c))
|
||||
|
||||
// Valid CSRF token
|
||||
token := generateCSRFToken(16)
|
||||
token := random.String(16)
|
||||
req.Header().Set(echo.HeaderCookie, "_csrf="+token)
|
||||
req.Header().Set(echo.HeaderXCSRFToken, token)
|
||||
if assert.NoError(t, h(c)) {
|
||||
|
Reference in New Issue
Block a user