Skip to content

Commit df6963b

Browse files
authored
Process BOM header (#5)
1 parent f2ffa73 commit df6963b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/run.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func run(configFile, httpFile string, h handler) error {
4040
if err != nil {
4141
return err
4242
}
43+
data = removeBOM(data)
4344
requests, err := parseHttp(string(data))
4445
if err != nil {
4546
return err
@@ -53,3 +54,10 @@ func run(configFile, httpFile string, h handler) error {
5354
}
5455
return nil
5556
}
57+
58+
func removeBOM(data []byte) []byte {
59+
if len(data) >= 3 && data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF {
60+
data = data[3:]
61+
}
62+
return data
63+
}

0 commit comments

Comments
 (0)