diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-12 23:36:04 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-12 23:36:04 -0400 |
commit | d2680fb62bac6c779f371b2b6839592274a8d281 (patch) | |
tree | ae6adcc3609396a44eed63462e292c57066f1dcb /handlers.go | |
parent | 1f8b2ce166e104bca99e4a758bb658dd27d5e4d6 (diff) | |
download | getwtxt-d2680fb62bac6c779f371b2b6839592274a8d281.tar.gz |
reorganized handlers. StrictSlash(true). handling POST /api/plain/users for new users
Diffstat (limited to 'handlers.go')
-rw-r--r-- | handlers.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/handlers.go b/handlers.go index 3998228..a44c9d8 100644 --- a/handlers.go +++ b/handlers.go @@ -64,6 +64,20 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) { } +// handles POST for "/api/plain/users" +func apiEndpointPOSTHandler(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + format := vars["format"] + endpoint := vars["endpoint"] + + w.Header().Set("Content-Type", htmlutf8) + n, err := w.Write([]byte(format + "/" + endpoint)) + if err != nil || n == 0 { + log.Printf("Error writing to HTTP stream: %v\n", err) + } + +} + // handles "/api/plain/tags" func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) |