Skip to content

Commit

Permalink
update echox tests to work with normalized paths
Browse files Browse the repository at this point in the history
An update in v4.12.0 introduced normalized paths which ensures
empty paths or paths without a prefixed `/` start with a `/`.

This is something we ran into previously which is why we had these tests.

Now that these routes are handled properly, we needed to update our tests
as all paths are prefixed with `/` now.

Relevant PR: labstack/echo#2616

Signed-off-by: Mike Mason <mimason@equinix.com>
  • Loading branch information
mikemrm committed Aug 8, 2024
1 parent f3cc20b commit 461dd37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions echox/echo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ func TestHandler(t *testing.T) {
routes = append(routes, route.Path)
}

assert.Contains(t, routes, "baseline", "expected baseline to exist in route list")
assert.Contains(t, routes, tc.path, "expected %s to exist in route list", tc.path)
assert.Contains(t, routes, "/baseline", "expected baseline to exist in route list")
assert.Contains(t, routes, "/"+strings.TrimLeft(tc.path, "/"), "expected /%s to exist in route list", tc.path)

w := httptest.NewRecorder()

Expand Down

0 comments on commit 461dd37

Please sign in to comment.