fix delete key endpoint

This commit is contained in:
Anish Mukherjee
2022-11-21 18:59:14 +05:30
parent aab92ce88d
commit c1f652487c
3 changed files with 8 additions and 8 deletions

View File

@@ -74,9 +74,10 @@ func request[T any](method, route string, payload any) *T {
log.Fatalf("Error response: %s", string(resBodyBytes))
}
body := new(T)
if err := json.Unmarshal(resBodyBytes, body); err != nil {
// log.Printf("Error unmarshalling JSON: %s", err)
return nil
if len(resBodyBytes) > 0 {
if err := json.Unmarshal(resBodyBytes, body); err != nil {
log.Printf("Error unmarshalling JSON: %s", err)
}
}
return body
}