Skip to content

Commit

Permalink
fix(auto-options): set the path parameter for the matched route (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerwill90 authored Jun 30, 2023
1 parent 25ce336 commit ed06170
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fox.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ NoMethodFallback:
if n, _ := tree.lookup(nds[i], target, c.params, c.skipNds, true); n != nil {
if sb.Len() > 0 {
sb.WriteString(", ")
} else {
c.path = n.path
}
sb.WriteString(nds[i].key)
}
Expand Down
1 change: 1 addition & 0 deletions fox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,7 @@ func TestRouterWithAutomaticOptions(t *testing.T) {

func TestRouterWithOptionsHandler(t *testing.T) {
f := New(WithOptionsHandler(func(c Context) {
assert.Equal(t, "/foo/bar", c.Path())
c.Writer().WriteHeader(http.StatusNoContent)
}))

Expand Down

0 comments on commit ed06170

Please sign in to comment.