add bugsnag test endpoint

This commit is contained in:
Andre Medeiros 2022-03-28 13:39:19 -04:00
parent 7e36609cda
commit 451a1a96fb

View file

@ -107,11 +107,21 @@ func (a *api) Routes() *mux.Router {
r.HandleFunc("/v1/receipt", a.checkReceiptHandler).Methods("POST") r.HandleFunc("/v1/receipt", a.checkReceiptHandler).Methods("POST")
r.HandleFunc("/v1/receipt/{apns}", a.checkReceiptHandler).Methods("POST") r.HandleFunc("/v1/receipt/{apns}", a.checkReceiptHandler).Methods("POST")
r.HandleFunc("/v1/test/bugsnag", a.testBugsnagHandler).Methods("POST")
r.Use(a.loggingMiddleware) r.Use(a.loggingMiddleware)
return r return r
} }
func (a *api) testBugsnagHandler(w http.ResponseWriter, r *http.Request) {
if err := bugsnag.Notify(fmt.Errorf("Test error")); err != nil {
a.errorResponse(w, r, 500, err.Error())
return
}
w.WriteHeader(http.StatusOK)
}
type LoggingResponseWriter struct { type LoggingResponseWriter struct {
w http.ResponseWriter w http.ResponseWriter
statusCode int statusCode int