Skip to content

Commit

Permalink
allow body for delete request
Browse files Browse the repository at this point in the history
  • Loading branch information
f3c0 committed Oct 29, 2019
1 parent dcf153e commit 5e2ae10
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/restc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,9 @@ content_type(Headers, Type) ->
default_content_type(Type) ->
{<<"content-type">>, get_ctype(Type)}.

do_request(post, Type, Url, Headers, Body, Options) ->
Body2 = encode_body(Type, Body),
hackney:request(post, Url, Headers, Body2, Options);
do_request(put, Type, Url, Headers, Body, Options) ->
Body2 = encode_body(Type, Body),
hackney:request(put, Url, Headers, Body2, Options);
do_request(patch, Type, Url, Headers, Body, Options) ->
Body2 = encode_body(Type, Body),
hackney:request(patch, Url, Headers, Body2, Options);
do_request(Method, Type, Url, Headers, Body, Options)
when Method =:= post; Method =:= put; Method =:= patch; Method =:= delete ->
hackney:request(Method, Url, Headers, encode_body(Type, Body), Options);
do_request(Method, _, Url, Headers, _, Options) when is_atom(Method) ->
hackney:request(Method, Url, Headers, [], Options).

Expand Down

0 comments on commit 5e2ae10

Please sign in to comment.