From 6d27e8f7a18c9b7969575fe82a1671c3b44af3be Mon Sep 17 00:00:00 2001 From: pshubham Date: Sun, 6 Oct 2024 20:13:08 +0530 Subject: [PATCH] Addressing review comments --- internal/server/http.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/internal/server/http.go b/internal/server/http.go index 9dab2c5..876f959 100644 --- a/internal/server/http.go +++ b/internal/server/http.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "errors" - "fmt" "log/slog" "net/http" "strings" @@ -102,13 +101,7 @@ func (s *HTTPServer) HealthCheck(w http.ResponseWriter, request *http.Request) { func (s *HTTPServer) CliHandler(w http.ResponseWriter, r *http.Request) { diceCmd, err := util.ParseHTTPRequest(r) if err != nil { - http.Error(w, errorResponse("error parsing http request"), http.StatusBadRequest) - return - } - - // Check if the command is blocklisted - if err := util.BlockListedCommand(diceCmd.Cmd); err != nil { - http.Error(w, errorResponse(fmt.Sprintf("ERR unknown command '%s'", diceCmd.Cmd)), http.StatusForbidden) + http.Error(w, errorResponse(err.Error()), http.StatusBadRequest) return }