mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 23:43:40 +00:00
examples: tell browsers to not cache wasm files from the example server
This commit is contained in:
committed by
Johan Brandhorst
parent
99da328453
commit
d594342642
@@ -12,6 +12,11 @@ func main() {
|
||||
fs := http.FileServer(http.Dir(dir))
|
||||
log.Print("Serving " + dir + " on http://localhost:8080")
|
||||
http.ListenAndServe(":8080", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||
resp.Header().Set("Cache-Control", "max-age=0")
|
||||
resp.Header().Add("Cache-Control", "no-store")
|
||||
resp.Header().Add("Cache-Control", "no-cache")
|
||||
resp.Header().Add("Cache-Control", "must-revalidate")
|
||||
resp.Header().Set("Expires", "Thu, 01 Jan 1970 00:00:00 GMT")
|
||||
if strings.HasSuffix(req.URL.Path, ".wasm") {
|
||||
resp.Header().Set("content-type", "application/wasm")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user