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
+2
View File
@@ -311,6 +311,8 @@ func Respond(status int, body any) *NormalResponse {
b = t
case string:
b = []byte(t)
case nil:
break
default:
var err error
if b, err = json.Marshal(body); err != nil {