Skip to content

Commit b35b144

Browse files
authored
fix: Allow encoded path parameters with slashes (#400)
1 parent fba0a14 commit b35b144

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

routers/gorillamux/router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewRouter(doc *openapi3.T) (routers.Router, error) {
5656
if len(servers) == 0 {
5757
servers = append(servers, srv{})
5858
}
59-
muxRouter := mux.NewRouter() /*.UseEncodedPath()?*/
59+
muxRouter := mux.NewRouter().UseEncodedPath()
6060
r := &Router{}
6161
for _, path := range orderedPaths(doc.Paths) {
6262
pathItem := doc.Paths[path]

routers/gorillamux/router_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func TestRouter(t *testing.T) {
146146
expect(r, http.MethodGet, "/params/a/b/c%2Fd", paramsGET, map[string]string{
147147
"x": "a",
148148
"y": "b",
149-
"z": "c/d",
149+
"z": "c%2Fd",
150150
})
151151
expect(r, http.MethodGet, "/books/War.and.Peace", paramsGET, map[string]string{
152152
"bookid": "War.and.Peace",

0 commit comments

Comments
 (0)