Skip to content

Commit 3f8de17

Browse files
committed
fix: do not read body if body len is 0
1 parent 9aa7f49 commit 3f8de17

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/minirest_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ match_path(_Path, _Pattern, _Bindings) ->
181181

182182
parse_params(Req) ->
183183
QueryParams = cowboy_req:parse_qs(Req),
184-
BodyParams = case cowboy_req:has_body(Req) of
184+
BodyParams = case cowboy_req:has_body(Req) andalso cowboy_req:body_length(Req) > 0 of
185185
true -> {_, Body, _} = cowboy_req:read_body(Req),
186186
json_decode(Body);
187187
false -> []

0 commit comments

Comments
 (0)