fix: prefix service path with '/' if missing

This commit is contained in:
Adrien Marquès 2019-05-01 16:28:16 +02:00
parent 16ea60f2aa
commit d0f5277bf4
1 changed files with 3 additions and 0 deletions

View File

@ -66,6 +66,9 @@ func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
return return
} }
servicePath := strings.Join(apiRequest.URI[:pathIndex], "/") servicePath := strings.Join(apiRequest.URI[:pathIndex], "/")
if !strings.HasPrefix(servicePath, "/") {
servicePath = "/" + servicePath
}
// 3. check if matching methodDef exists in config */ // 3. check if matching methodDef exists in config */
var methodDef = serviceDef.Method(req.Method) var methodDef = serviceDef.Method(req.Method)