(t *testing.T)
| 384 | } |
| 385 | |
| 386 | func TestCSRFSetSameSiteMode(t *testing.T) { |
| 387 | e := echo.New() |
| 388 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 389 | rec := httptest.NewRecorder() |
| 390 | c := e.NewContext(req, rec) |
| 391 | |
| 392 | csrf := CSRFWithConfig(CSRFConfig{ |
| 393 | CookieSameSite: http.SameSiteStrictMode, |
| 394 | }) |
| 395 | |
| 396 | h := csrf(func(c *echo.Context) error { |
| 397 | return c.String(http.StatusOK, "test") |
| 398 | }) |
| 399 | |
| 400 | r := h(c) |
| 401 | assert.NoError(t, r) |
| 402 | assert.Regexp(t, "SameSite=Strict", rec.Header()["Set-Cookie"]) |
| 403 | } |
| 404 | |
| 405 | func TestCSRFWithoutSameSiteMode(t *testing.T) { |
| 406 | e := echo.New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…