commit | b65c9180c10f67ba84c9ab92a0f5f43ed0c1a8a4 | [log] [tgz] |
---|---|---|
author | Robert Newson <rnewson@apache.org> | Sun Jul 12 14:20:25 2015 +0100 |
committer | Robert Newson <rnewson@apache.org> | Sun Jul 12 14:25:57 2015 +0100 |
tree | aaa36d9a0355b977216b8f7a8e543510a9ae354d | |
parent | bcb7c1a36ebece3c3b6f47d2a96e700e09fee292 [diff] |
Send 400 Bad Request if request body is missing
diff --git a/src/couch_httpd.erl b/src/couch_httpd.erl index 8e5555c..3260721 100644 --- a/src/couch_httpd.erl +++ b/src/couch_httpd.erl
@@ -545,7 +545,12 @@ ReqBody. json_body(Httpd) -> - ?JSON_DECODE(maybe_decompress(Httpd, body(Httpd))). + case body(Httpd) of + undefined -> + throw({bad_request, "Missing request body"}); + Body -> + ?JSON_DECODE(maybe_decompress(Httpd, Body)) + end. json_body_obj(Httpd) -> case json_body(Httpd) of