(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func 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 | } |
nothing calls this directly
no test coverage detected