Fix parsing of JSON with a UTF8 BOM in httpjson (#3267)

This commit is contained in:
Daniel Nelson
2017-09-26 15:36:00 -07:00
committed by GitHub
parent 9938d5f2e3
commit 5a66090264
2 changed files with 21 additions and 1 deletions

View File

@@ -560,3 +560,18 @@ func TestHttpJsonArray200Tags(t *testing.T) {
}
}
}
var jsonBOM = []byte("\xef\xbb\xbf[{\"value\":17}]")
// TestHttpJsonBOM tests that UTF-8 JSON with a BOM can be parsed
func TestHttpJsonBOM(t *testing.T) {
httpjson := genMockHttpJson(string(jsonBOM), 200)
for _, service := range httpjson {
if service.Name == "other_webapp" {
var acc testutil.Accumulator
err := acc.GatherError(service.Gather)
require.NoError(t, err)
}
}
}