Send empty http response when body is nil (#80196)

* build empty response if body is nil

* fix test
This commit is contained in:
Mihai Doarna
2024-01-29 14:17:56 +02:00
committed by GitHub
parent 67feb0bba1
commit 6b28669e1f
3 changed files with 49 additions and 4 deletions

View File

@@ -269,10 +269,7 @@ func TestAPIDeletePublicDashboard(t *testing.T) {
assert.Equal(t, test.ExpectedHttpResponse, response.Code)
if test.ExpectedHttpResponse == http.StatusOK {
var jsonResp any
err := json.Unmarshal(response.Body.Bytes(), &jsonResp)
require.NoError(t, err)
assert.Equal(t, jsonResp, nil)
assert.Equal(t, []byte(nil), response.Body.Bytes())
}
if !test.ShouldCallService {