[#1976] added HEAD requests support for the file download action

This commit is contained in:
Gani Georgiev
2023-03-05 15:37:50 +02:00
parent dc96a12dc0
commit 42e288c71a
32 changed files with 49 additions and 35 deletions
+1
View File
@@ -18,6 +18,7 @@ func bindFileApi(app core.App, rg *echo.Group) {
api := fileApi{app: app}
subGroup := rg.Group("/files", ActivityLogger(app))
subGroup.HEAD("/:collection/:recordId/:filename", api.download, LoadCollectionContext(api.app))
subGroup.GET("/:collection/:recordId/:filename", api.download, LoadCollectionContext(api.app))
}
+8
View File
@@ -179,6 +179,14 @@ func TestFileDownload(t *testing.T) {
}
for _, scenario := range scenarios {
// clone for the HEAD test (the same as the original scenario but without body)
head := scenario
head.Method = http.MethodHead
head.Name = ("(HEAD) " + scenario.Name)
head.ExpectedContent = nil
head.Test(t)
// regular request test
scenario.Test(t)
}
}