mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Fix parameter routes with an extension (/foo/:id.json)
This is a follow-up to #1101. It turns out that that patch is incomplete, as a similar check also needs to be added in the `Router.Add()` method. I don't understand why the test works fine, but when using it in a real application. For example with this example: func main() { e := echo.New() e.GET("/xxx/:id.json", func(c echo.Context) error { return c.String(200, fmt.Sprintf("%#v: names: %#v; vals: %#v", c.Path(), c.ParamNames(), c.ParamValues())) }) log.Fatal(e.Start(":8000")) } Gives a 404 on `/xxx/42.json`, and for `/xxx/42` it gives the output: /xxx/:id.json": names: []string{"id.json"}; vals: []string{"42"} It makes sense to add the test there too; I just don't get why the test cases that I added in ##1101 *does* produce the correct output :-/
This commit is contained in:
parent
5b769f91b2
commit
cf7b55584d
Loading…
Reference in New Issue
Block a user