mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Error before sending json object if something bad happend with reading a request body
This commit is contained in:
@@ -37,6 +37,9 @@ func (h *JSONProtocol) DumpJSON(req *http.Request) error {
|
||||
stdin := json.NewEncoder(h.in)
|
||||
bb := new(bytes.Buffer)
|
||||
_, err := bb.ReadFrom(req.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = writeString(err, h.in, "{")
|
||||
err = writeString(err, h.in, `"body":`)
|
||||
err = stdin.Encode(bb.String())
|
||||
|
||||
Reference in New Issue
Block a user