mirror of https://github.com/gofiber/fiber.git
fix cookie value sanitization tests
parent
8d7a7dcb44
commit
71c75ae998
|
@ -1027,6 +1027,7 @@ func Benchmark_Ctx_Cookie(b *testing.B) {
|
|||
}
|
||||
|
||||
// go test -run Test_Ctx_Cookies
|
||||
// Semicolons cannot be part of cookie values because they're used as cookie delimiters in HTTP spec
|
||||
func Test_Ctx_Cookies(t *testing.T) {
|
||||
t.Parallel()
|
||||
app := New()
|
||||
|
@ -1042,9 +1043,6 @@ func Test_Ctx_Cookies(t *testing.T) {
|
|||
c.Request().Header.Set("Cookie", "quotes=value\"with\"quotes")
|
||||
require.Equal(t, "valuewithquotes", c.Req().Cookies("quotes"))
|
||||
|
||||
c.Request().Header.Set("Cookie", "semicolons=value;with;semicolons")
|
||||
require.Equal(t, "valuewithsemicolons", c.Req().Cookies("semicolons"))
|
||||
|
||||
c.Request().Header.Set("Cookie", "backslash=value\\with\\backslash")
|
||||
require.Equal(t, "valuewithbackslash", c.Req().Cookies("backslash"))
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const CorrectKey = "specials: !$%,.#\"!?~`<>@$^*(){}[]|/\\123"
|
||||
const CorrectKey = "specials: !$%.#!?~`<>@$^*(){}[]|/123"
|
||||
|
||||
var testConfig = fiber.TestConfig{
|
||||
Timeout: 0,
|
||||
|
|
Loading…
Reference in New Issue