feat: workspace helpers - quoting paths, what a dropped file does, with node tests
This commit is contained in:
1 parent
0ada0899cf
commit
7b9daa524e
4 files changed
+90
No files matched your search
@@ -434,6 +434,11 @@ func assetHashes(fsys fs.FS) map[string]string {
|
||||
func staticHandler(fsys fs.FS, hashes map[string]string) http.Handler {
|
||||
files := http.FileServer(http.FS(fsys))
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// The JS tests sit beside the scripts but are not served.
|
||||
if strings.HasSuffix(r.URL.Path, ".test.js") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
h := hashes[strings.TrimPrefix(r.URL.Path, "/")]
|
||||
if h != "" {
|
||||
w.Header().Set("ETag", `"`+h+`"`)
|
||||
|
||||
Reference in new issue
Block a user