Skip to content

Commit

Permalink
Change http status error codes
Browse files Browse the repository at this point in the history
This is to be clearer in response logs.
  • Loading branch information
richardhallett committed Oct 16, 2023
1 parent d71037c commit 2a90990
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/app/net/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (s *Http) createMetric(w http.ResponseWriter, r *http.Request) {

// Return a bad request if useragent is a bot
if isBot(r.UserAgent()) {
http.Error(w, "Event request denied due to known bot", http.StatusBadRequest)
http.Error(w, "Event request denied due to known bot", http.StatusForbidden)
return
}

Expand All @@ -207,7 +207,7 @@ func (s *Http) createMetric(w http.ResponseWriter, r *http.Request) {
// Format error message
errorMessage := fmt.Sprintf("%s - %s, Usage stats cannot be processed", eventRequest.Pid, err.Error())

http.Error(w, errorMessage, http.StatusBadRequest)
http.Error(w, errorMessage, http.StatusUnprocessableEntity)

return
}
Expand Down

0 comments on commit 2a90990

Please sign in to comment.