go test -run Test_Ctx_Cookie_Invalid
(t *testing.T)
| 1581 | |
| 1582 | // go test -run Test_Ctx_Cookie_Invalid |
| 1583 | func Test_Ctx_Cookie_Invalid(t *testing.T) { |
| 1584 | t.Parallel() |
| 1585 | app := New() |
| 1586 | |
| 1587 | cases := []*Cookie{ |
| 1588 | {Name: "", Value: "a"}, // empty name |
| 1589 | {Name: "foo bar", Value: "a"}, // invalid char in name |
| 1590 | {Name: "n", Value: "bad\nval"}, // invalid value byte |
| 1591 | {Name: "d", Value: "b", Domain: "in valid"}, // invalid domain spaces |
| 1592 | {Name: "d", Value: "b", Domain: "example..com"}, // invalid domain dots |
| 1593 | {Name: "i", Value: "b", Domain: "2001:db8::1"}, // ipv6 not allowed |
| 1594 | {Name: "p", Value: "b", Path: "\x00"}, // invalid path byte |
| 1595 | {Name: "e", Value: "b", Expires: time.Date(1500, 1, 1, 0, 0, 0, 0, time.UTC)}, // invalid expires |
| 1596 | // Note: Partitioned without Secure is auto-fixed (Secure=true set automatically per CHIPS spec) |
| 1597 | } |
| 1598 | |
| 1599 | for _, invalid := range cases { |
| 1600 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 1601 | c.Res().Cookie(invalid) |
| 1602 | require.Empty(t, c.Res().Get(HeaderSetCookie)) |
| 1603 | c.Response().Header.Reset() |
| 1604 | app.ReleaseCtx(c) |
| 1605 | } |
| 1606 | } |
| 1607 | |
| 1608 | // go test -run Test_Ctx_Cookie_DefaultPath |
| 1609 | func Test_Ctx_Cookie_DefaultPath(t *testing.T) { |
nothing calls this directly
no test coverage detected