Skip to content

URL Path Parameter get bugged #1461

Closed
Closed
@constantins2001

Description

@constantins2001

Issue Description

Context#Param(name string) doesn't work in certain constellations.

Checklist

  • [ X ] Dependencies installed
  • [ X ] No typos
  • [ X ] Searched existing issues and docs

Expected behaviour

The following code yields results for handler1 (using c.Param("page")) and for handler3 and handler4 (using c.Param("id"))

	mux.GET("path/:page", handler1)
	mux.POST("path", handler2)
	mux.PATCH("path/:id", handler3)
	mux.DELETE("path/:id", handler4)

Actual behaviour

The following code yields and empty string for handler3 and handler4 (using c.Param("id")).

	mux.GET("path/:page", handler1)
	mux.POST("path", handler2)
	mux.PATCH("path/:id", handler3)
	mux.DELETE("path/:id", handler4)

The following code yields and empty string for handler1 (using c.Param("page")).

	mux.POST("path", handler2)
	mux.PATCH("path/:id", handler3)
	mux.DELETE("path/:id", handler4)
        mux.GET("path/:page", handler1)

Steps to reproduce

func handler3(c echo.Context) error {
	idParam := c.Param("id")
        log.Println(idParam);
}

Working code to debug

See above

Version/commit

Latest (github.com/labstack/echo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions