Skip to content

Commit ce7a74f

Browse files
committed
Handle missing routes in GetRouteURL
1 parent d02760d commit ce7a74f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

mount_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func Test_App_UseMountedErrorHandlerForBestPrefixMatch(t *testing.T) {
384384

385385
resp2, err := app.Test(httptest.NewRequest(MethodGet, "/api/sub/third", http.NoBody))
386386
require.NoError(t, err, "/api/sub/third req")
387-
require.Equal(t, 200, resp.StatusCode, "Status code")
387+
require.Equal(t, 200, resp2.StatusCode, "Status code")
388388

389389
b, err = io.ReadAll(resp2.Body)
390390
require.NoError(t, err, "iotuil.ReadAll()")

res.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func (r *DefaultRes) ViewBind(vars Map) error {
572572

573573
// getLocationFromRoute get URL location from route using parameters
574574
func (r *DefaultRes) getLocationFromRoute(route *Route, params Map) (string, error) {
575-
if route == nil {
575+
if route == nil || route.Path == "" {
576576
return "", ErrNotFound
577577
}
578578

0 commit comments

Comments
 (0)