diff options
Diffstat (limited to 'pkg/api/message.go')
-rw-r--r-- | pkg/api/message.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkg/api/message.go b/pkg/api/message.go index 1c28285..81e863f 100644 --- a/pkg/api/message.go +++ b/pkg/api/message.go @@ -35,16 +35,21 @@ func (a *API) getMessageHandler(w http.ResponseWriter, r *http.Request) { } func (a *API) postPointHandler(w http.ResponseWriter, r *http.Request) { + msg, pauth := r.PathValue("tmsg"), r.PathValue("pauth") if err := r.ParseForm(); err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } + form := r.PostForm - a.savePointMessage(w, form.Get("tmsg"), form.Get("pauth")) -} + if form.Has("tmsg") { + msg = form.Get("tmsg") + } + if form.Has("pauth") { + pauth = form.Get("pauth") + } -func (a *API) getPointHandler(w http.ResponseWriter, r *http.Request) { - a.savePointMessage(w, r.PathValue("tmsg"), r.PathValue("pauth")) + a.savePointMessage(w, msg, pauth) } func (a *API) savePointMessage(w http.ResponseWriter, rawMessage, auth string) error { |