diff options
Diffstat (limited to 'input')
-rw-r--r-- | input/http/http.go | 5 | ||||
-rw-r--r-- | input/stdin/stdin.go | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/input/http/http.go b/input/http/http.go index 87ec0f9..61e2c39 100644 --- a/input/http/http.go +++ b/input/http/http.go @@ -50,10 +50,13 @@ func (hi *HTTPInput) httphandler(w http.ResponseWriter, r *http.Request) { return } all, err := ioutil.ReadAll(r.Body) + wrk := &work.Work{Data: all} if err != nil { fmt.Printf("Error when reading HTTP request body: %q\n", err) + wrk.SetError(err) } - hi.retchan <- &work.Work{Data: all, Err: err} + + hi.retchan <- wrk } func (hi *HTTPInput) Start() chan *work.Work { diff --git a/input/stdin/stdin.go b/input/stdin/stdin.go index 394b952..4421741 100644 --- a/input/stdin/stdin.go +++ b/input/stdin/stdin.go @@ -33,10 +33,15 @@ func (i *StdinInput) Start() chan *work.Work { if err == io.EOF { break } + + w := &work.Work{Data: bs} + if err != nil { fmt.Printf("Error when reading input from Stdin: %q", err) + w.SetError(err) } - i.retchan <- &work.Work{Data: bs, Err: err} + + i.retchan <- w } close(i.retchan) }() |