Skip to content

Commit

Permalink
print error parsing params
Browse files Browse the repository at this point in the history
  • Loading branch information
tedpearson committed Jun 22, 2024
1 parent 0ed0cd8 commit af0805a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ func (s *Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
// get params
err := req.ParseForm()
if err != nil {
resp.WriteHeader(http.StatusBadRequest)
fmt.Printf("Failed to parse form: %s", err)
resp.WriteHeader(http.StatusBadRequest)
}
params, err := s.ParseParams(req.Form)
if err != nil {
fmt.Printf("Failed to parse params: %s", err)
resp.WriteHeader(http.StatusBadRequest)
resp.Write([]byte("{}"))
_, err = resp.Write([]byte("{}"))
if err != nil {
fmt.Printf("Error writing response to client: %+v\n", err)
}
return
}

Expand Down

0 comments on commit af0805a

Please sign in to comment.