@@ -152,6 +152,7 @@ func TestStaticFile(t *testing.T) {
152152 require .NoError (t , os .WriteFile (filepath .Join (d , "static" , "foo" , "foo" ), []byte ("foo page" ), 0755 ))
153153 require .NoError (t , os .Mkdir (filepath .Join (d , "static" , "foo" , "bar" ), 0755 ))
154154 require .NoError (t , os .WriteFile (filepath .Join (d , "static" , "foo" , "bar" , "bar" ), []byte ("bar page" ), 0755 ))
155+ require .NoError (t , os .WriteFile (filepath .Join (d , "static" , "foo" ,"index.html" ), []byte ("sub index page" ), 0755 ))
155156
156157 fn , err := DummyPublic (d , "cat" , "-" )
157158 require .NoError (t , err )
@@ -189,6 +190,21 @@ func TestStaticFile(t *testing.T) {
189190 require .NoError (t , err )
190191 assert .Equal (t , "bar page" , string (content ))
191192 })
193+ t .Run ("sub path with index.html served (no trailing slash)" , func (t * testing.T ) {
194+ content , err := testRequest (fn , http .MethodGet , "/f/foo" , nil )
195+ require .NoError (t , err )
196+ assert .Equal (t , "sub index page" , string (content ))
197+ })
198+ t .Run ("sub path with index.html served (with trailing slash)" , func (t * testing.T ) {
199+ content , err := testRequest (fn , http .MethodGet , "/f/foo/" , nil )
200+ require .NoError (t , err )
201+ assert .Equal (t , "sub index page" , string (content ))
202+ })
203+ t .Run ("sub path with index.html served (with trailing slash + index.html)" , func (t * testing.T ) {
204+ content , err := testRequest (fn , http .MethodGet , "/f/foo/index.html" , nil )
205+ require .NoError (t , err )
206+ assert .Equal (t , "sub index page" , string (content ))
207+ })
192208}
193209
194210func testRequest (fn application.Invokable , method string , path string , payload []byte ) ([]byte , error ) {
0 commit comments