From d0f5277bf4ac7109335e196cb527349222980078 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 1 May 2019 16:28:16 +0200 Subject: [PATCH] fix: prefix service path with '/' if missing --- server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.go b/server.go index d90a10a..d9205d8 100644 --- a/server.go +++ b/server.go @@ -66,6 +66,9 @@ func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) { return } servicePath := strings.Join(apiRequest.URI[:pathIndex], "/") + if !strings.HasPrefix(servicePath, "/") { + servicePath = "/" + servicePath + } // 3. check if matching methodDef exists in config */ var methodDef = serviceDef.Method(req.Method)