summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2016-12-04 20:34:38 +0100
committerSilvan Jegen <s.jegen@gmail.com>2016-12-04 20:34:38 +0100
commit70299d51aeb8dc53a15eb06d46d4d2419619fd47 (patch)
treed56aca2d323b193ad4bfc704df431dad4c3f86f4
parent6474565d976da6d980e7a91a133d45bca10e2412 (diff)
Don't use Form values, just read the body
-rw-r--r--manager.go15
1 files 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 {