mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 05:23:40 +00:00
example: just using 'Cache-Control': 'no-cache' should be good enough
This commit is contained in:
@@ -12,15 +12,10 @@ 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")
|
||||
}
|
||||
|
||||
fs.ServeHTTP(resp, req)
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user