http: add GET route for clients
This commit is contained in:
parent
f98e166744
commit
443fb4b70d
2 changed files with 8 additions and 0 deletions
|
@ -83,6 +83,7 @@ func newRouter(s *Server) *httprouter.Router {
|
|||
}
|
||||
|
||||
if s.config.ClientWhitelistEnabled {
|
||||
r.GET("/clients/:clientID", makeHandler(s.getClient))
|
||||
r.PUT("/clients/:clientID", makeHandler(s.putClient))
|
||||
r.DELETE("/clients/:clientID", makeHandler(s.delClient))
|
||||
}
|
||||
|
|
|
@ -178,6 +178,13 @@ func (s *Server) delUser(w http.ResponseWriter, r *http.Request, p httprouter.Pa
|
|||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
func (s *Server) getClient(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
if err := s.tracker.ClientApproved(p.ByName("clientID")); err != nil {
|
||||
return http.StatusNotFound, err
|
||||
}
|
||||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
func (s *Server) putClient(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
s.tracker.PutClient(p.ByName("clientID"))
|
||||
return http.StatusOK, nil
|
||||
|
|
Loading…
Add table
Reference in a new issue