1
0
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:
Roland Lammel
2021-01-03 01:09:18 +01:00
parent 08073575f8
commit 4310e90d58
3 changed files with 25 additions and 1 deletions

View 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
)

View 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
)

View File

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