internally, http.Error uses fmt.Fprintln() which will append a newline to what should be an empty response body. In one of my previous tests, this was causing spurious errors. I've since rewritten that test, but still best to avoid it here.
also add specific error type checking for invalid JSON test
This now aligns with the (pretty strong) golang convention of the package name matching the path basename