summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--svc/handlers.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/svc/handlers.go b/svc/handlers.go
index 645b3fc..cf9d279 100644
--- a/svc/handlers.go
+++ b/svc/handlers.go
@@ -46,18 +46,23 @@ func servStatic(w http.ResponseWriter, isCSS bool) error {
 	staticCache.mu.RLock()
 	defer staticCache.mu.RUnlock()
 
+	var etag string
+	var body []byte
+	var contentType string
+
 	if isCSS {
-		etag := getEtagFromTime(staticCache.cssMod)
-		w.Header().Set("ETag", "\""+etag+"\"")
-		w.Header().Set("Content-Type", cssutf8)
-		_, err := w.Write(staticCache.css)
-		return err
+		etag = getEtagFromTime(staticCache.cssMod)
+		contentType = cssutf8
+		body = staticCache.css
+	} else {
+		etag = getEtagFromTime(staticCache.indexMod)
+		contentType = htmlutf8
+		body = staticCache.index
 	}
 
-	etag := getEtagFromTime(staticCache.indexMod)
 	w.Header().Set("ETag", "\""+etag+"\"")
-	w.Header().Set("Content-Type", htmlutf8)
-	_, err := w.Write(staticCache.index)
+	w.Header().Set("Content-Type", contentType)
+	_, err := w.Write(body)
 	return err
 }
 
='#n113'>113 114 115 116 117 118