MCPcopy
hub / github.com/tinyauthapp/tinyauth / TestSanitizeHeader

Function TestSanitizeHeader

internal/utils/label_utils_test.go:68–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestSanitizeHeader(t *testing.T) {
69 // Normal case
70 header := "X-Custom-Header"
71 expected := "X-Custom-Header"
72 assert.Equal(t, expected, utils.SanitizeHeader(header))
73
74 // Header with unsafe characters
75 header = "X-Cust\x00om-Hea\x7Fder" // Null byte and DEL character
76 expected = "X-Custom-Header"
77 assert.Equal(t, expected, utils.SanitizeHeader(header))
78
79 // Header with only unsafe characters
80 header = "\x00\x01\x02\x7F"
81 expected = ""
82 assert.Equal(t, expected, utils.SanitizeHeader(header))
83
84 // Header with spaces and tabs (should be preserved)
85 header = "X Custom\tHeader"
86 expected = "X Custom\tHeader"
87 assert.Equal(t, expected, utils.SanitizeHeader(header))
88}

Callers

nothing calls this directly

Calls 1

SanitizeHeaderFunction · 0.92

Tested by

no test coverage detected