Skip to content

Commit 235b450

Browse files
committed
update
1 parent 93469ba commit 235b450

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

context_x_base.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ func (c *XContext) SetDispatchPath(route string) {
467467
}
468468

469469
func (c *XContext) DispatchPath() string {
470+
if len(c.dispatchRoute) == 0 {
471+
return c.Request().URL().Path()
472+
}
470473
return c.dispatchRoute
471474
}
472475

middleware/language/language.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ func (a *Language) Set(lang string, on bool, args ...bool) *Language {
107107

108108
func (a *Language) DetectURI(c echo.Context) string {
109109
dispatchPath := c.DispatchPath()
110-
if len(dispatchPath) == 0 {
111-
dispatchPath = c.Request().URL().Path()
112-
}
113110
p := strings.TrimPrefix(dispatchPath, `/`)
114111
s := strings.Index(p, `/`)
115112
var lang string

router.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,10 +619,7 @@ func NewRouter(e *Echo) *Router {
619619
}
620620

621621
func (r *Router) Handle(c Context) Handler {
622-
if len(c.DispatchPath()) > 0 {
623-
return r.Dispatch(c, c.DispatchPath())
624-
}
625-
return r.Dispatch(c, c.Request().URL().Path())
622+
return r.Dispatch(c, c.DispatchPath())
626623
}
627624

628625
func (r *Router) Dispatch(c Context, path string, _method ...string) Handler {

0 commit comments

Comments
 (0)