diff --git a/cmd/noxy/main.go b/cmd/noxy/main.go index 7047835..5516286 100644 --- a/cmd/noxy/main.go +++ b/cmd/noxy/main.go @@ -1,6 +1,7 @@ package main import ( + "context" "encoding/json" "errors" "flag" @@ -197,6 +198,8 @@ func writeError(w http.ResponseWriter, err error) { w.WriteHeader(http.StatusBadRequest) case errors.Is(err, noxy.ErrNotFound): w.WriteHeader(http.StatusNotFound) + case errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled): + w.WriteHeader(http.StatusServiceUnavailable) } fmt.Fprint(w, err.Error()) }