From 97e435cda39df070310fab9a3b7dfb8d7305c97a Mon Sep 17 00:00:00 2001 From: Vivek Bharath Akupatni Date: Mon, 14 Oct 2024 13:05:55 -0400 Subject: [PATCH] Fix error message when unimplemented method is invoked (#1078) --- internal/server/httpServer.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/server/httpServer.go b/internal/server/httpServer.go index b153517b6..e4572c631 100644 --- a/internal/server/httpServer.go +++ b/internal/server/httpServer.go @@ -147,7 +147,7 @@ func (s *HTTPServer) DiceHTTPHandler(writer http.ResponseWriter, request *http.R } if unimplementedCommands[diceDBCmd.Cmd] { - responseJSON, _ := json.Marshal(utils.HTTPResponse{Status: utils.HTTPStatusError, Data: "Command is not implemented with HTTP"}) + responseJSON, _ := json.Marshal(utils.HTTPResponse{Status: utils.HTTPStatusError, Data: fmt.Sprintf("Command %s is not implemented with HTTP", diceDBCmd.Cmd)}) writer.Header().Set("Content-Type", "application/json") writer.WriteHeader(http.StatusBadRequest) // Set HTTP status code to 500 _, err = writer.Write(responseJSON) @@ -155,11 +155,6 @@ func (s *HTTPServer) DiceHTTPHandler(writer http.ResponseWriter, request *http.R s.logger.Error("Error writing response", "error", err) } s.logger.Error("Command %s is not implemented", slog.String("cmd", diceDBCmd.Cmd)) - _, err := writer.Write([]byte("Command is not implemented with HTTP")) - if err != nil { - s.logger.Error("Error writing response", slog.Any("error", err)) - return - } return }