diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-12 21:11:48 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-12 21:20:04 -0400 |
commit | 979e1f93d563637bcca99bcc56a03199807b92d8 (patch) | |
tree | de41d25b8cc3ea5f2dbf56be3e593db8e68f37cf /svc/handlers.go | |
parent | 0544d1584899c5edc9ac161f90428b6c3febfc94 (diff) | |
download | getwtxt-979e1f93d563637bcca99bcc56a03199807b92d8.tar.gz |
separate request and message log
Diffstat (limited to 'svc/handlers.go')
-rw-r--r-- | svc/handlers.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/svc/handlers.go b/svc/handlers.go index def01ad..924b487 100644 --- a/svc/handlers.go +++ b/svc/handlers.go @@ -42,12 +42,10 @@ func servStatic(w http.ResponseWriter, isCSS bool) error { // handles "/" and "/css" func staticHandler(w http.ResponseWriter, r *http.Request) { isCSS := strings.Contains(r.URL.Path, "css") - if err := servStatic(w, isCSS); err != nil { errHTTP(w, r, err, http.StatusInternalServerError) return } - log200(r) } @@ -69,17 +67,15 @@ func apiAllTweetsHandler(w http.ResponseWriter, r *http.Request) { } 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) if err != nil { errHTTP(w, r, err, http.StatusInternalServerError) return } - log200(r) } @@ -134,8 +130,8 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) { errLog("", err) data := parseQueryOut(out) - etag := fmt.Sprintf("%x", sha256.Sum256(data)) + w.Header().Set("ETag", etag) w.Header().Set("Content-Type", txtutf8) @@ -162,8 +158,8 @@ func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) { out = registry.ReduceToPage(1, out) data := parseQueryOut(out) - etag := fmt.Sprintf("%x", sha256.Sum256(data)) + w.Header().Set("ETag", etag) w.Header().Set("Content-Type", txtutf8) @@ -172,7 +168,6 @@ func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) { errHTTP(w, r, err, http.StatusInternalServerError) return } - log200(r) } @@ -184,8 +179,8 @@ func apiTagsHandler(w http.ResponseWriter, r *http.Request) { out := compositeStatusQuery("#"+tags, r) out = registry.ReduceToPage(1, out) data := parseQueryOut(out) - etag := fmt.Sprintf("%x", sha256.Sum256(data)) + w.Header().Set("ETag", etag) w.Header().Set("Content-Type", txtutf8) @@ -194,6 +189,5 @@ func apiTagsHandler(w http.ResponseWriter, r *http.Request) { errHTTP(w, r, err, http.StatusInternalServerError) return } - log200(r) } |