Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gotjosh committed Nov 22, 2023
1 parent 119e1c4 commit 93c6ea4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions api/v1_deprecation_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,13 @@ func (dr *V1DeprecationRouter) deprecationHandler(w http.ResponseWriter, req *ht
Error string `json:"error"`
}{
"deprecated",
"The Alertmanager v1 API was deprecated in version 0.16.0 and entirely removed since version 0.28.0 - please use the equivalent route in the v2 API",
"The Alertmanager v1 API was deprecated in version 0.16.0 and is removed as of version 0.28.0 - please use the equivalent route in the v2 API",
}

w.Header().Set("Content-Type", "application/json")
w.WriteHeader(410)

// We don't care about errors for this route.
b, _ := json.Marshal(resp)

if _, err := w.Write(b); err != nil {
level.Error(dr.logger).Log("msg", "failed to write data to connection", "err", err)
if err := json.NewEncoder(w).Encode(resp); err != nil {
level.Error(dr.logger).Log("msg", "failed to write response", "err", err)
}
}

0 comments on commit 93c6ea4

Please sign in to comment.