Closed rudranil-das closed 2 years ago
I think this is coming because server is sending text rather than json. This should fix if we use WriteHeader after Header
func WriteJSONResponse(w http.ResponseWriter, statuscode int, data JSONWriter) (int, error) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(statuscode)
return w.Write([]byte(data.ToJson()))
}
@jkristia I think this is issue in goserver generation. Probably kind of restriction in net/htp that put WriteHeader() after Hear()set(). Please review
This should address in https://github.com/open-traffic-generator/snappi/releases/tag/v0.7.1
Snappi version: This issue is observed with dev version of snappi [https://github.com/open-traffic-generator/snappi/tree/gosnappi_server_tmp/gosnappi]
Ideally the server implementation should not have any impact on the snappi client-side. But I am observing anomaly in the client-side results (python client) as mentioned below,
In python-client, we verify if the response of a snappi api has required constructs (e.g. if set_config has 200 ok response, it should have 'warnings')
With snappi-version 0.6.21, this response object ('res') is as expected,
But with snappi version with http implementation, the response object looks incorrect
As a result, basic E2E test is failing.