1
0
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:
Vishal Rana
2016-07-18 23:24:50 -07:00
parent 0dab439ea4
commit 579cb79a41
3 changed files with 12 additions and 19 deletions

View File

@ -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)) {