discovery.go 670 B

123456789101112131415161718192021222324252627282930313233
  1. package http
  2. import (
  3. "strings"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func discoveryProxy(c *bm.Context) {
  8. req := c.Request
  9. idx := strings.Index(req.URL.Path, "/x/admin/apm/discovery/")
  10. if idx == -1 {
  11. c.JSON(nil, ecode.RequestErr)
  12. return
  13. }
  14. data, err := apmSvc.DiscoveryProxy(c, req.Method, req.URL.Path[idx+len("/x/admin/apm/discovery/"):], req.Form)
  15. if err != nil {
  16. c.JSON(nil, err)
  17. return
  18. }
  19. c.JSON(data, nil)
  20. }
  21. func discoveryProxyNoAuth(c *bm.Context) {
  22. req := c.Request
  23. data, err := apmSvc.DiscoveryProxy(c, req.Method, "fetch", req.Form)
  24. if err != nil {
  25. c.JSON(nil, err)
  26. return
  27. }
  28. c.JSON(data, nil)
  29. }