diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-08-28 16:10:01 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-08-28 16:10:01 -0400 |
commit | 910e69ac1b504ba0b9616d84280690c719cfaa3c (patch) | |
tree | afd08e17d12b4638d1bd8dad6bfc580bbbe4ed54 /svc/handlers.go | |
parent | 0862bfa13c77484461eb96b2d94180d835ef2805 (diff) | |
download | getwtxt-910e69ac1b504ba0b9616d84280690c719cfaa3c.tar.gz |
endpoint for version response v0.4.5
Diffstat (limited to 'svc/handlers.go')
-rw-r--r-- | svc/handlers.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/svc/handlers.go b/svc/handlers.go index 5a46521..bd9ec62 100644 --- a/svc/handlers.go +++ b/svc/handlers.go @@ -141,6 +141,18 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) { out, err = twtxtCache.QueryAllStatuses() out = registry.ReduceToPage(page, out) + case "/api/plain/version": + etag := fmt.Sprintf("%x", sha256.Sum256([]byte(Vers))) + w.Header().Set("ETag", "\""+etag+"\"") + w.Header().Set("Content-Type", txtutf8) + _, err := w.Write([]byte(strings.TrimSpace("getwtxt " + Vers))) + if err != nil { + errHTTP(w, r, err, http.StatusInternalServerError) + return + } + log200(r) + return + default: errHTTP(w, r, fmt.Errorf("endpoint not found"), http.StatusNotFound) return |