mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: exact path matching for api endpoints (resolve #194)
This commit is contained in:
parent
0673c26043
commit
11b224fc24
@ -17,7 +17,7 @@ func NewHealthApiHandler(db *gorm.DB) *HealthApiHandler {
|
||||
|
||||
func (h *HealthApiHandler) RegisterRoutes(router *mux.Router) {
|
||||
r := router.PathPrefix("/health").Subrouter()
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
// @Summary Check the application's health status
|
||||
|
@ -39,7 +39,7 @@ func (h *HeartbeatApiHandler) RegisterRoutes(router *mux.Router) {
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler,
|
||||
customMiddleware.NewWakatimeRelayMiddleware().Handler,
|
||||
)
|
||||
r.Methods(http.MethodPost).HandlerFunc(h.Post)
|
||||
r.Path("").Methods(http.MethodPost).HandlerFunc(h.Post)
|
||||
}
|
||||
|
||||
// @Summary Push a new heartbeat
|
||||
|
@ -64,7 +64,7 @@ func (h *MetricsHandler) RegisterRoutes(router *mux.Router) {
|
||||
r.Use(
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler,
|
||||
)
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
func (h *MetricsHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -29,7 +29,7 @@ func (h *SummaryApiHandler) RegisterRoutes(router *mux.Router) {
|
||||
r.Use(
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler,
|
||||
)
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
// @Summary Retrieve a summary
|
||||
|
@ -32,7 +32,7 @@ func (h *AllTimeHandler) RegisterRoutes(router *mux.Router) {
|
||||
r.Use(
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler,
|
||||
)
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
// @Summary Retrieve summary for all time
|
||||
|
@ -33,7 +33,7 @@ func (h *SummariesHandler) RegisterRoutes(router *mux.Router) {
|
||||
r.Use(
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler,
|
||||
)
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
// TODO: Support parameters: project, branches, timeout, writes_only, timezone
|
||||
|
@ -29,7 +29,7 @@ func (h *UsersHandler) RegisterRoutes(router *mux.Router) {
|
||||
r.Use(
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler,
|
||||
)
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
// @Summary Retrieve the given user
|
||||
|
Loading…
x
Reference in New Issue
Block a user