diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2016-12-04 20:34:38 +0100 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2016-12-04 20:34:38 +0100 |
commit | 70299d51aeb8dc53a15eb06d46d4d2419619fd47 (patch) | |
tree | d56aca2d323b193ad4bfc704df431dad4c3f86f4 | |
parent | 6474565d976da6d980e7a91a133d45bca10e2412 (diff) |
Don't use Form values, just read the body
-rw-r--r-- | manager.go | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -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 { |