summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriilyak <iilyak@users.noreply.github.com>2020-11-16 09:55:41 -0800
committerGitHub <noreply@github.com>2020-11-16 09:55:41 -0800
commit5cfa4a8ee12255bbd87f1e88dbce2b526a3014e1 (patch)
tree59f3fd31fb5851e51273a58831d89f03c290fab7
parent679fc835f0e52cdcbe811fc6a6b7434ecf636172 (diff)
parent1be23124b7a867a966ce39ec66231bc2d2779ca9 (diff)
downloadcouchdb-5cfa4a8ee12255bbd87f1e88dbce2b526a3014e1.tar.gz
Merge pull request #3268 from cloudant/reuse-json-body
Use `req_body` field if present
-rw-r--r--src/couch/src/couch_httpd.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 8f7fedd5e..53d14d793 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -599,13 +599,16 @@ body(#httpd{mochi_req=MochiReq, req_body=undefined}) ->
body(#httpd{req_body=ReqBody}) ->
ReqBody.
-json_body(Httpd) ->
+json_body(#httpd{req_body=undefined} = Httpd) ->
case body(Httpd) of
undefined ->
throw({bad_request, "Missing request body"});
Body ->
?JSON_DECODE(maybe_decompress(Httpd, Body))
- end.
+ end;
+
+json_body(#httpd{req_body=ReqBody}) ->
+ ReqBody.
json_body_obj(Httpd) ->
case json_body(Httpd) of