From e4e2d7000f7fb0285f580b7eab48579e39b50eab Mon Sep 17 00:00:00 2001 From: Tushar-E <55044345+Tushar-kalsi@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:47:18 +0530 Subject: [PATCH] Changes made in error codes. --- backend/handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/handlers.go b/backend/handlers.go index 1f44cb0..3c57a6e 100644 --- a/backend/handlers.go +++ b/backend/handlers.go @@ -49,19 +49,19 @@ func (cs *server) publishHandler(w http.ResponseWriter, r *http.Request, _ httpr var sensorIDMap map[string]string // Decode into the sensorDataMap if err := decoder.Decode(&sensorIDMap); err != nil { - http.Error(w, "JSON decoding error: "+err.Error(), http.StatusBadRequest) + http.Error(w, err.Error(), http.StatusBadRequest) return } // Get the sensorID from the map sensorID, exists := sensorIDMap["sensorID"] if !exists { - http.Error(w, "Sensor Id does not exists.", http.StatusBadRequest) + http.Error(w, "sensor id does not exists", http.StatusBadRequest) return } if len(sensorID) < 8 { - http.Error(w, "Sensor ID must have at least 8 characters.", http.StatusBadRequest) + http.Error(w, "sensor id must have at least 8 characters", http.StatusBadRequest) return }