mirror of https://github.com/statping/statping
updated method naming
parent
fc89bcdd31
commit
9452a37b2a
|
@ -213,7 +213,7 @@ func returnJson(d interface{}, w http.ResponseWriter, r *http.Request) {
|
|||
json.NewEncoder(w).Encode(d)
|
||||
}
|
||||
|
||||
func returnResponseCode(s *services.Service, w http.ResponseWriter, r *http.Request) {
|
||||
func returnLastResponse(s *services.Service, w http.ResponseWriter, r *http.Request) {
|
||||
// Go does not currently
|
||||
// support sending user-defined 1xx informational headers,
|
||||
// with the exception of 100-continue response header that the
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"time"
|
||||
|
||||
sentryhttp "github.com/getsentry/sentry-go/http"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/statping/statping/source"
|
||||
"github.com/statping/statping/types/core"
|
||||
"github.com/statping/statping/utils"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"time"
|
||||
|
||||
_ "github.com/statping/statping/types/metrics"
|
||||
)
|
||||
|
@ -137,8 +138,8 @@ func Router() *mux.Router {
|
|||
api.Handle("/api/services/{id}/failures", authenticated(servicesDeleteFailuresHandler, false)).Methods("DELETE")
|
||||
api.Handle("/api/services/{id}/hits", scoped(apiServiceHitsHandler)).Methods("GET")
|
||||
api.Handle("/api/services/{id}/hits", authenticated(apiServiceHitsDeleteHandler, false)).Methods("DELETE")
|
||||
api.Handle("/api/services/{id}/responsecode", authenticated(apiServiceResponseCodeHandler, false)).Methods("GET")
|
||||
|
||||
api.Handle("/api/services/{id}/lastresponse", authenticated(apiServiceLastResponseHandler, false)).Methods("GET")
|
||||
|
||||
// API SERVICE CHART DATA Routes
|
||||
api.Handle("/api/services/{id}/hits_data", cached("30s", "application/json", apiServiceDataHandler)).Methods("GET")
|
||||
api.Handle("/api/services/{id}/failure_data", cached("30s", "application/json", apiServiceFailureDataHandler)).Methods("GET")
|
||||
|
|
|
@ -318,7 +318,7 @@ func apiServiceHitsHandler(r *http.Request) interface{} {
|
|||
return hts
|
||||
}
|
||||
|
||||
func apiServiceResponseCodeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
func apiServiceLastResponseHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
service, err := findService(r)
|
||||
if err != nil {
|
||||
|
@ -326,5 +326,5 @@ func apiServiceResponseCodeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
returnResponseCode(service, w, r)
|
||||
returnLastResponse(service, w, r)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue