Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Nov 16, 2023
1 parent 22b336f commit be0bdf1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os"
"strings"
"sync"
"time"

"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
Expand Down Expand Up @@ -226,7 +227,7 @@ func javaScriptHandler(c echo.Context) error {
}

c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("Expires", time.Now().AddDate(1, 0, 0).Format(http.TimeFormat))
c.Response().Header().Set("ETag", p.Sha1())

return c.Blob(http.StatusOK, "application/javascript", runtime.Script)
Expand All @@ -244,7 +245,7 @@ func webAssemblyHandler(c echo.Context) error {
}

c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("Expires", time.Now().AddDate(1, 0, 0).Format(http.TimeFormat))
c.Response().Header().Set("ETag", p.Sha1())

return c.Blob(http.StatusOK, "application/wasm", runtime.Binary)
Expand All @@ -262,7 +263,7 @@ func bundleHandler(c echo.Context) error {
}

c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("Expires", time.Now().AddDate(1, 0, 0).Format(http.TimeFormat))
c.Response().Header().Set("ETag", p.Sha1())

return c.Blob(http.StatusOK, "application/zip", bundle)
Expand Down

0 comments on commit be0bdf1

Please sign in to comment.