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