MCPcopy
hub / github.com/labstack/echo / TestCSRFWithoutSameSiteMode

Function TestCSRFWithoutSameSiteMode

middleware/csrf_test.go:405–420  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

403}
404
405func TestCSRFWithoutSameSiteMode(t *testing.T) {
406 e := echo.New()
407 req := httptest.NewRequest(http.MethodGet, "/", nil)
408 rec := httptest.NewRecorder()
409 c := e.NewContext(req, rec)
410
411 csrf := CSRFWithConfig(CSRFConfig{})
412
413 h := csrf(func(c *echo.Context) error {
414 return c.String(http.StatusOK, "test")
415 })
416
417 r := h(c)
418 assert.NoError(t, r)
419 assert.NotRegexp(t, "SameSite=", rec.Header()["Set-Cookie"])
420}
421
422func TestCSRFWithSameSiteDefaultMode(t *testing.T) {
423 e := echo.New()

Callers

nothing calls this directly

Calls 4

StringMethod · 0.95
CSRFWithConfigFunction · 0.85
NewContextMethod · 0.80
HeaderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…