@@ -3653,6 +3653,73 @@ func Test_Ctx_Route(t *testing.T) {
36533653 require .Empty (t , c .Route ().Handlers )
36543654}
36553655
3656+ // go test -run Test_Ctx_FullPath
3657+ func Test_Ctx_FullPath (t * testing.T ) {
3658+ t .Parallel ()
3659+
3660+ app := New ()
3661+ app .Get ("/test" , func (c Ctx ) error {
3662+ require .Equal (t , "/test" , c .FullPath ())
3663+ return c .SendStatus (StatusOK )
3664+ })
3665+
3666+ resp , err := app .Test (httptest .NewRequest (MethodGet , "/test" , nil ))
3667+ require .NoError (t , err , "app.Test(req)" )
3668+ defer func () { require .NoError (t , resp .Body .Close ()) }()
3669+
3670+ require .Equal (t , StatusOK , resp .StatusCode )
3671+ }
3672+
3673+ // go test -run Test_Ctx_FullPath_Group
3674+ func Test_Ctx_FullPath_Group (t * testing.T ) {
3675+ t .Parallel ()
3676+
3677+ app := New ()
3678+ group := app .Group ("/v1" )
3679+ group .Get ("/test" , func (c Ctx ) error {
3680+ require .Equal (t , "/v1/test" , c .FullPath ())
3681+ return c .SendStatus (StatusOK )
3682+ })
3683+
3684+ resp , err := app .Test (httptest .NewRequest (MethodGet , "/v1/test" , nil ))
3685+ require .NoError (t , err , "app.Test(req)" )
3686+ defer func () { require .NoError (t , resp .Body .Close ()) }()
3687+
3688+ require .Equal (t , StatusOK , resp .StatusCode )
3689+ }
3690+
3691+ // go test -run Test_Ctx_FullPath_Middleware
3692+ func Test_Ctx_FullPath_Middleware (t * testing.T ) {
3693+ t .Parallel ()
3694+
3695+ app := New ()
3696+
3697+ var recorded []string
3698+
3699+ app .Use (func (c Ctx ) error {
3700+ recorded = append (recorded , c .FullPath ())
3701+
3702+ if err := c .Next (); err != nil {
3703+ return err
3704+ }
3705+
3706+ recorded = append (recorded , c .FullPath ())
3707+ return nil
3708+ })
3709+
3710+ app .Get ("/test" , func (c Ctx ) error {
3711+ require .Equal (t , "/test" , c .FullPath ())
3712+ return c .SendStatus (StatusOK )
3713+ })
3714+
3715+ resp , err := app .Test (httptest .NewRequest (MethodGet , "/test" , nil ))
3716+ require .NoError (t , err , "app.Test(req)" )
3717+ defer func () { require .NoError (t , resp .Body .Close ()) }()
3718+
3719+ require .Equal (t , StatusOK , resp .StatusCode )
3720+ require .Equal (t , []string {"/" , "/test" }, recorded )
3721+ }
3722+
36563723// go test -run Test_Ctx_RouteNormalized
36573724func Test_Ctx_RouteNormalized (t * testing.T ) {
36583725 t .Parallel ()
0 commit comments