MCPcopy
hub / github.com/gofiber/fiber / Test_UnescapeHeaderValue

Function Test_UnescapeHeaderValue

helpers_test.go:1520–1541  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1518}
1519
1520func Test_UnescapeHeaderValue(t *testing.T) {
1521 t.Parallel()
1522 cases := []struct {
1523 in string
1524 out []byte
1525 ok bool
1526 }{
1527 {in: "abc", out: []byte("abc"), ok: true},
1528 {in: "a\\\"b", out: []byte("a\"b"), ok: true},
1529 {in: "c\\\\d", out: []byte("c\\d"), ok: true},
1530 {in: "bad\\", ok: false},
1531 }
1532 for _, tc := range cases {
1533 out, err := unescapeHeaderValue([]byte(tc.in))
1534 if tc.ok {
1535 require.NoError(t, err, tc.in)
1536 require.Equal(t, tc.out, out, tc.in)
1537 } else {
1538 require.Error(t, err, tc.in)
1539 }
1540 }
1541}
1542
1543func Test_JoinHeaderValues(t *testing.T) {
1544 t.Parallel()

Callers

nothing calls this directly

Calls 2

unescapeHeaderValueFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…