Skip to content

Commit

Permalink
Simplify request payload checking
Browse files Browse the repository at this point in the history
  • Loading branch information
pan93412 committed Nov 28, 2024
1 parent f8508ed commit f052e0e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,8 @@ func (s *SqlQueryService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

if req.Schema == "" {
respond(w, http.StatusUnprocessableEntity, NewFailedResponse(NewBadPayloadError("Schema is required")))
return
}

if req.Query == "" {
respond(w, http.StatusUnprocessableEntity, NewFailedResponse(NewBadPayloadError("Query is required")))
if req.Schema == "" || req.Query == "" {
respond(w, http.StatusUnprocessableEntity, NewFailedResponse(NewBadPayloadError("Schema and Query is required")))
return
}

Expand Down

0 comments on commit f052e0e

Please sign in to comment.