You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As documented: "Context.Path() returns the registered path for the handler."
I couldn't really find any documentation of what this is supposed to return if there's no registered handler (eg. a 404 in a middleware). Currently it just returns the request path, seems confusing to me, since the registered paths are trusted strings, whereas request paths can be anything.
This is causing an issue for us in the Prometheus middleware, which assumes Context.path to be a safe string from registered handlers, but it is not. labstack/echo-contrib#86
IMO it should be set to something like "" in this case, which would fix the issue in the middleware above, but also this is somewhat of a breaking change? Curious to hear others' thoughts on this.
As documented: "Context.Path() returns the registered path for the handler."
I couldn't really find any documentation of what this is supposed to return if there's no registered handler (eg. a 404 in a middleware). Currently it just returns the request path, seems confusing to me, since the registered paths are trusted strings, whereas request paths can be anything.
This is causing an issue for us in the Prometheus middleware, which assumes Context.path to be a safe string from registered handlers, but it is not. labstack/echo-contrib#86
IMO it should be set to something like
""
in this case, which would fix the issue in the middleware above, but also this is somewhat of a breaking change? Curious to hear others' thoughts on this.Edit: Opened a PR: #2385
The text was updated successfully, but these errors were encountered: