From a6f47c07100be337f32325792990e58f5f4a3506 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Sun, 26 May 2019 01:48:12 -0400 Subject: simplified indexHandler to reference staticCache sending ETag with all GET responses: sha256 of raw bytes --- query.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'query.go') diff --git a/query.go b/query.go index 63e203c..17d7a36 100644 --- a/query.go +++ b/query.go @@ -1,6 +1,7 @@ package main import ( + "crypto/sha256" "fmt" "log" "net/http" @@ -107,7 +108,10 @@ func apiEndpointQuery(w http.ResponseWriter, r *http.Request) error { data := parseQueryOut(out) + etag := fmt.Sprintf("%x", sha256.Sum256(data)) + w.Header().Set("ETag", etag) w.Header().Set("Content-Type", txtutf8) + _, err = w.Write(data) return err -- cgit 1.4.1-2-gfad0