mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-05 11:10:47 -06:00
[server][img] Support caching responses
This commit is contained in:
@@ -31,9 +31,9 @@ func handleImgRequest(c *gin.Context) {
|
||||
} else if img == nil {
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
} else {
|
||||
// TODO: Caching
|
||||
c.Writer.WriteHeader(http.StatusOK)
|
||||
c.Writer.Header().Set("Content-Type", "image/webp")
|
||||
c.Writer.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
|
||||
defer img.Close()
|
||||
io.Copy(c.Writer, img)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user