mirror of
https://github.com/labstack/echo.git
synced 2025-11-29 22:48:07 +02:00
Support Go 1.12 for http.SameSiteNoneMode
This commit is contained in:
12
middleware/csrf_samesite.go
Normal file
12
middleware/csrf_samesite.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// +build !go1.12
|
||||
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const (
|
||||
// SameSiteNoneMode required to be redefined for Go 1.12 support (see #1524)
|
||||
SameSiteNoneMode http.SameSite = http.SameSiteNoneMode
|
||||
)
|
||||
12
middleware/csrf_samesite_1.12.go
Normal file
12
middleware/csrf_samesite_1.12.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// +build go1.12
|
||||
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const (
|
||||
// SameSiteNoneMode required to be redefined for Go 1.12 support (see #1524)
|
||||
SameSiteNoneMode http.SameSite = 4
|
||||
)
|
||||
@@ -146,7 +146,7 @@ func TestCSRFWithSameSiteModeNone(t *testing.T) {
|
||||
c := e.NewContext(req, rec)
|
||||
|
||||
csrf := CSRFWithConfig(CSRFConfig{
|
||||
CookieSameSite: http.SameSiteNoneMode,
|
||||
CookieSameSite: SameSiteNoneMode,
|
||||
})
|
||||
|
||||
h := csrf(func(c echo.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user