Skip to content

Commit

Permalink
Add cases to http.TestVars()
Browse files Browse the repository at this point in the history
  • Loading branch information
tchssk committed Sep 25, 2023
1 parent bad408f commit 559d145
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions http/mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ func TestVars(t *testing.T) {
"post_id": "456/789",
},
},
{
Name: "escaped",
Pattern: "/users/{id}",
URL: "/users/%40123",
Expected: map[string]string{
"id": "@123",
},
},
{
Name: "escaped wildcard",
Pattern: "/users/{id}/posts/{*post_id}",
URL: "/users/%40123/posts/456/789%24",
Expected: map[string]string{
"id": "@123",
"post_id": "456/789$",
},
},
{
Name: "no var",
Pattern: "/users",
Expand Down

0 comments on commit 559d145

Please sign in to comment.