@@ -107,7 +107,7 @@ func Test_FileSystem(t *testing.T) {
107
107
url : "/spatest/doesnotexist" ,
108
108
statusCode : 200 ,
109
109
contentType : "text/html" ,
110
- }, /******/
110
+ },
111
111
{
112
112
name : "PathPrefix should be applied" ,
113
113
url : "/prefix/fiber.png" ,
@@ -145,6 +145,22 @@ func Test_FileSystem_Next(t *testing.T) {
145
145
utils .AssertEqual (t , fiber .StatusNotFound , resp .StatusCode )
146
146
}
147
147
148
+ // go test -run Test_FileSystem_Download
149
+ func Test_FileSystem_Download (t * testing.T ) {
150
+ app := fiber .New ()
151
+ app .Use (New (Config {
152
+ Root : os .DirFS ("../../.github/testdata/fs" ),
153
+ Download : true ,
154
+ }))
155
+
156
+ resp , err := app .Test (httptest .NewRequest ("GET" , "/img/fiber.png" , nil ))
157
+ utils .AssertEqual (t , nil , err , "app.Test(req)" )
158
+ utils .AssertEqual (t , 200 , resp .StatusCode , "Status code" )
159
+ utils .AssertEqual (t , false , resp .Header .Get (fiber .HeaderContentLength ) == "" )
160
+ utils .AssertEqual (t , "image/png" , resp .Header .Get (fiber .HeaderContentType ))
161
+ utils .AssertEqual (t , `attachment` , resp .Header .Get (fiber .HeaderContentDisposition ))
162
+ }
163
+
148
164
func Test_FileSystem_NonGetAndHead (t * testing.T ) {
149
165
app := fiber .New ()
150
166
0 commit comments