I have a web service implemented in Go that returns a JSON structure from an external service. Upon returning the object, it looks like this:
{"otherServiceInfoList":[],"action...
My Go web service simply reads the JSON to a slice:
response, err := ioutil.ReadAll(resp.Body)
and returns it to the client:
w.Write(response)
The response is displayed as-is in Postman, however Fiddler both prepends and appends the response as follows:
34ee
{"otherServiceInfoList":[],"...
0
Note the leading 34ee
and trailing 0
.
I am then promoted to transform the response:
"Response is encoded and may require decoding before inspection."
Accepting the prompt removes returns the original JSON. Is Go's w.write
method applying the extra characters, or is this specific to Fiddler?
Incidentally, I'm setting the following header before writing to the buffer:
w.Header().Set("Content-Type", "application/json; charset=UTF-8")