diff options
-rw-r--r-- | system/api/server.go | 12 | ||||
-rw-r--r-- | system/db/cache.go | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/system/api/server.go b/system/api/server.go index f8c9ba9..823ec16 100644 --- a/system/api/server.go +++ b/system/api/server.go @@ -1,14 +1,16 @@ package api -import "net/http" +import ( + "net/http" +) // Run adds Handlers to default http listener for API func Run() { - http.HandleFunc("/api/types", Record((CORS(typesHandler)))) + http.HandleFunc("/api/types", CORS(Record(typesHandler))) - http.HandleFunc("/api/contents", Record((CORS(contentsHandler)))) + http.HandleFunc("/api/contents", CORS(Record(contentsHandler))) - http.HandleFunc("/api/content", Record((CORS(contentHandler)))) + http.HandleFunc("/api/content", CORS(Record(contentHandler))) - http.HandleFunc("/api/content/external", Record((CORS(externalContentHandler)))) + http.HandleFunc("/api/content/external", CORS(Record(externalContentHandler))) } diff --git a/system/db/cache.go b/system/db/cache.go index 4076848..e964906 100644 --- a/system/db/cache.go +++ b/system/db/cache.go @@ -18,7 +18,7 @@ func CacheControl(next http.Handler) http.HandlerFunc { res.Header().Add("Etag", etag) res.Header().Add("Cache-Control", policy) - if match := res.Header().Get("If-None-Match"); match != "" { + if match := req.Header.Get("If-None-Match"); match != "" { if strings.Contains(match, etag) { fmt.Println("matched etag") res.WriteHeader(http.StatusNotModified) |