From c835231d32335937f556319ddec139d6a880554f Mon Sep 17 00:00:00 2001 From: Jianwei Zhang Date: Thu, 10 Aug 2023 23:45:30 +0800 Subject: [PATCH] feat: add header into resource response (#2120) Update - add header for get resource --- api/v1/resource.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/v1/resource.go b/api/v1/resource.go index ff71d640..5b5a5f9d 100644 --- a/api/v1/resource.go +++ b/api/v1/resource.go @@ -490,6 +490,7 @@ func (s *APIV1Service) streamResource(c echo.Context) error { http.ServeContent(c.Response(), c.Request(), resource.Filename, time.Unix(resource.UpdatedTs, 0), bytes.NewReader(blob)) return nil } + c.Response().Writer.Header().Set("Content-Disposition", fmt.Sprintf(`filename="%s"`, resource.Filename)) return c.Stream(http.StatusOK, resourceType, bytes.NewReader(blob)) }