From 70299d51aeb8dc53a15eb06d46d4d2419619fd47 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sun, 4 Dec 2016 20:34:38 +0100 Subject: Don't use Form values, just read the body --- manager.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/manager.go b/manager.go index 086740e..2029552 100644 --- a/manager.go +++ b/manager.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "io" + "io/ioutil" "net/http" "os" "strings" @@ -83,20 +84,12 @@ func (hi *HTTPInput) httphandler(w http.ResponseWriter, r *http.Request) { fmt.Printf("Expected POST method was: %q\n", r.Method) return } - err := r.ParseForm() + all, err := ioutil.ReadAll(r.Body) if err != nil { - fmt.Printf("Error when parsing HTTP request form values: %q\n", err) + fmt.Printf("Error when reading HTTP request body: %q\n", err) return } - workdata := r.PostForm["work"] - fmt.Printf("Form %#v\n", r.Form) - if workdata == nil { - fmt.Printf("Work form field was empty.\n") - return - } - - fmt.Printf("Work form field was: %q\n", workdata) - hi.retchan <- &Work{data: []byte(workdata[0])} + hi.retchan <- &Work{data: all} } func (hi *HTTPInput) Start() chan *Work { -- cgit v1.2.3