diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-20 21:05:03 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-20 21:08:15 -0400 |
commit | dec003b9f8bf7ed5b77c867e74dba061a9ec0c92 (patch) | |
tree | 6be654e554af2f9f848b32a38535d28e24eaf127 | |
parent | f4eb1c7b2b93f2a53f8b41bc8e32253ed2fd6438 (diff) | |
download | getwtxt-dec003b9f8bf7ed5b77c867e74dba061a9ec0c92.tar.gz |
apiTagsBaseHandler returning all statuses with '#' - return all statuses with tags. will debug later
-rw-r--r-- | handlers.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/handlers.go b/handlers.go index 9a2a7c6..345e6b9 100644 --- a/handlers.go +++ b/handlers.go @@ -102,7 +102,7 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) { return } - w.Header().Set("Content-Type", htmlutf8) + w.Header().Set("Content-Type", txtutf8) _, err = w.Write([]byte(r.URL.String())) if err != nil { @@ -134,12 +134,17 @@ func apiEndpointPOSTHandler(w http.ResponseWriter, r *http.Request) { // handles "/api/plain/tags" func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - format := vars["format"] + out, err := twtxtCache.QueryInStatus("#") + if err != nil { + log500(w, r, err) + return + } - w.Header().Set("Content-Type", htmlutf8) + data := parseQueryOut(out) - _, err := w.Write([]byte("api/" + format + "/tags")) + w.Header().Set("Content-Type", txtutf8) + + _, err = w.Write(data) if err != nil { log500(w, r, err) return |