@@ -354,7 +354,7 @@ func Test_Router_Handler_Catch_Error(t *testing.T) {
354
354
func Test_Route_Static_Root (t * testing.T ) {
355
355
t .Parallel ()
356
356
357
- dir := "./.github/testdata/fs/css"
357
+ dir := "./.github/testdata/fs/css" //nolint:goconst // ignore lint
358
358
app := New ()
359
359
app .Static ("/" , dir , Static {
360
360
Browse : true ,
@@ -471,6 +471,37 @@ func Test_Route_Static_HasPrefix(t *testing.T) {
471
471
body , err = io .ReadAll (resp .Body )
472
472
utils .AssertEqual (t , nil , err , "app.Test(req)" )
473
473
utils .AssertEqual (t , true , strings .Contains (app .getString (body ), "color" ))
474
+
475
+ app = New ()
476
+ app .Static ("/css" , dir )
477
+
478
+ resp , err = app .Test (httptest .NewRequest (MethodGet , "/css/style.css" , nil ))
479
+ utils .AssertEqual (t , nil , err , "app.Test(req)" )
480
+ utils .AssertEqual (t , 200 , resp .StatusCode , "Status code" )
481
+
482
+ body , err = io .ReadAll (resp .Body )
483
+ utils .AssertEqual (t , nil , err , "app.Test(req)" )
484
+ utils .AssertEqual (t , true , strings .Contains (app .getString (body ), "color" ))
485
+ }
486
+
487
+ func Test_Route_Static_SubApp (t * testing.T ) {
488
+ t .Parallel ()
489
+
490
+ dir := "./.github/testdata/fs/css"
491
+ app := New ()
492
+
493
+ subApp := New ()
494
+ subApp .Static ("/css" , dir )
495
+
496
+ app .Mount ("/sub" , subApp )
497
+
498
+ resp , err := app .Test (httptest .NewRequest (MethodGet , "/sub/css/style.css" , nil ))
499
+ utils .AssertEqual (t , nil , err , "app.Test(req)" )
500
+ utils .AssertEqual (t , 200 , resp .StatusCode , "Status code" )
501
+
502
+ body , err := io .ReadAll (resp .Body )
503
+ utils .AssertEqual (t , nil , err , "app.Test(req)" )
504
+ utils .AssertEqual (t , true , strings .Contains (app .getString (body ), "color" ))
474
505
}
475
506
476
507
func Test_Router_NotFound (t * testing.T ) {
0 commit comments