export pathvar for user-defined routers (#911)

* refactor

* export pathvar for user-defined routers
This commit is contained in:
Kevin Wan
2021-08-14 22:57:28 +08:00
committed by GitHub
parent fbf2eebc42
commit fc04ad7854
6 changed files with 23 additions and 23 deletions

View File

@@ -7,7 +7,7 @@ import (
"strings"
"github.com/tal-tech/go-zero/core/mapping"
"github.com/tal-tech/go-zero/rest/internal/context"
"github.com/tal-tech/go-zero/rest/pathvar"
)
const (
@@ -119,7 +119,7 @@ func ParseJsonBody(r *http.Request, v interface{}) error {
// ParsePath parses the symbols reside in url path.
// Like http://localhost/bag/:name
func ParsePath(r *http.Request, v interface{}) error {
vars := context.Vars(r)
vars := pathvar.Vars(r)
m := make(map[string]interface{}, len(vars))
for k, v := range vars {
m[k] = v