From 7280e43cbfd2312799f156656092355985ca11e9 Mon Sep 17 00:00:00 2001 From: Jacob Chambliss Date: Thu, 8 Jun 2023 10:14:21 -0500 Subject: [PATCH] chore: add pathprefix to enable dynamic paths for echo --- pkg/api/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/api/server.go b/pkg/api/server.go index c90775d87..b4224f45b 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -100,8 +100,8 @@ func (s *Server) registerHandlers() { s.router.HandleFunc("/", s.indexHandler).HeadersRegexp("User-Agent", "^Mozilla.*").Methods("GET") s.router.HandleFunc("/", s.infoHandler).Methods("GET") s.router.HandleFunc("/version", s.versionHandler).Methods("GET") - s.router.HandleFunc("/echo", s.echoHandler).Methods("POST,PUT") - s.router.HandleFunc("/echo/{echo:.*}", s.echoHandler).Methods("POST,PUT") + s.router.HandleFunc("/echo", s.echoHandler) + s.router.PathPrefix("/echo/").HandlerFunc(s.echoHandler) s.router.HandleFunc("/env", s.envHandler).Methods("GET", "POST") s.router.HandleFunc("/headers", s.echoHeadersHandler).Methods("GET", "POST") s.router.HandleFunc("/delay/{wait:[0-9]+}", s.delayHandler).Methods("GET").Name("delay") @@ -120,8 +120,8 @@ func (s *Server) registerHandlers() { s.router.HandleFunc("/token", s.tokenGenerateHandler).Methods("POST") s.router.HandleFunc("/token/validate", s.tokenValidateHandler).Methods("GET") s.router.HandleFunc("/api/info", s.infoHandler).Methods("GET") - s.router.HandleFunc("/api/echo", s.echoHandler).Methods("POST,PUT") - s.router.HandleFunc("/api/echo{echo:.*}", s.echoHandler).Methods("POST,PUT") + s.router.HandleFunc("/api/echo", s.echoHandler) + s.router.PathPrefix("/api/echo/").HandlerFunc(s.echoHandler) s.router.HandleFunc("/ws/echo", s.echoWsHandler) s.router.HandleFunc("/chunked", s.chunkedHandler) s.router.HandleFunc("/chunked/{wait:[0-9]+}", s.chunkedHandler)