From aa2ecace89633f2b914994b8169e50224a28a8fe Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 5 Jun 2020 17:03:08 +0100 Subject: [PATCH] Don't send the empty error value in responses --- pkg/server/api.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/server/api.go b/pkg/server/api.go index c2e4e9a..5e40393 100644 --- a/pkg/server/api.go +++ b/pkg/server/api.go @@ -25,7 +25,7 @@ type RegisterData struct { // RegisterResponse describes the response to a register request type RegisterResponse struct { Success bool `json:"success"` - Error string `json:"error"` + Error string `json:"error,omitempty"` Id string `json:"id"` } @@ -43,7 +43,7 @@ type SpawnData struct { // SpawnResponse is the data to respond with on a spawn command type SpawnResponse struct { Success bool `json:"success"` - Error string `json:"error"` + Error string `json:"error,omitempty"` // The location of the spawned entity Position game.Vector `json:"position"` @@ -62,7 +62,7 @@ type CommandsData struct { // CommandsResponse is the response to be sent back type CommandsResponse struct { Success bool `json:"success"` - Error string `json:"error"` + Error string `json:"error,omitempty"` } const ( @@ -104,7 +104,7 @@ type RadarData struct { // RadarResponse describes the response to a /radar call type RadarResponse struct { Success bool `json:"success"` - Error string `json:"error"` + Error string `json:"error,omitempty"` // The set of positions for nearby rovers Rovers []game.Vector `json:"rovers"`