Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware echo.Context Lost Path #2459

Closed
wanglihui opened this issue Jun 9, 2023 · 1 comment
Closed

middleware echo.Context Lost Path #2459

wanglihui opened this issue Jun 9, 2023 · 1 comment

Comments

@wanglihui
Copy link

middleware echo.Context Lost Path

v4.9.1 is correct
v4.10.2 is not correct;

Expected behaviour

c.Path() Get correct request Path

Actual behaviour

c.Path() Get ""

Steps to reproduce

see example code

Working code to debug

func Middleware(m *core.Mgr) echo.MiddlewareFunc {
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
                         // c.Path() is ""
			if c.Path() != m.GetPath() {
				return next(c)
			}
               //do some else
             }
       }
}
@aldas
Copy link
Contributor

aldas commented Jun 9, 2023

This relates to PR #2385 / Issue #2384

c.Path() is meant to be return path that handler was registered to i.e. /api/users/:id. Previously in cases of 404/405 it was filled with c.Request().URL.Path value and that caused problems knowing if handler/middleware chain that is currently being executed will end with "actual" route of something that Router added as replacement for 404/405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants