Skip to content

Commit

Permalink
Merge pull request #51 from emqx/add-patch
Browse files Browse the repository at this point in the history
feat: add support for patch method
  • Loading branch information
thalesmg authored Jun 19, 2023
2 parents 90fd629 + c761893 commit e8d4f0d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ehttpc changes

## 0.4.11

- Added support for `PATCH` method requests.

## 0.4.10

- Fixed `ehttpc:request` and `ehttpc:request_async` to handle `Timeout = infinity` option.
Expand Down
2 changes: 1 addition & 1 deletion src/ehttpc.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, ehttpc,
[{description, "HTTP Client for Erlang/OTP"},
{vsn, "0.4.10"},
{vsn, "0.4.11"},
{registered, []},
{applications, [kernel,
stdlib,
Expand Down
8 changes: 7 additions & 1 deletion src/ehttpc.appup.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
%% -*- mode: erlang -*-
{"0.4.10",
{"0.4.11",
[
{"0.4.10", [
{load_module, ehttpc, brutal_purge, soft_purge, []}
]},
{"0.4.9", [
{load_module, ehttpc, brutal_purge, soft_purge, []}
]},
Expand Down Expand Up @@ -60,6 +63,9 @@
]}
],
[
{"0.4.10", [
{load_module, ehttpc, brutal_purge, soft_purge, []}
]},
{"0.4.9", [
{load_module, ehttpc, brutal_purge, soft_purge, []}
]},
Expand Down
4 changes: 4 additions & 0 deletions src/ehttpc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,10 @@ do_request(Client, get, {Path, Headers}) ->
RequestRef = gun:get(Client, Path, Headers),
finish_body_call_if_needed(Client, RequestRef, Headers, <<>>),
RequestRef;
do_request(Client, patch, {Path, Headers, Body}) ->
RequestRef = gun:patch(Client, Path, Headers, Body),
finish_body_call_if_needed(Client, RequestRef, Headers, Body),
RequestRef;
do_request(Client, post, {Path, Headers, Body}) ->
RequestRef = gun:post(Client, Path, Headers, Body),
finish_body_call_if_needed(Client, RequestRef, Headers, Body),
Expand Down
2 changes: 1 addition & 1 deletion test/ehttpc_appup_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ensure_vsn_bump_test() ->
V = parse_semver(proplists:get_value(vsn, Props)),
?assert(TagV =< V).

ensuer_changelog_test() ->
ensure_changelog_test() ->
{ok, [{application, ehttpc, Props}]} = file:consult("src/ehttpc.app.src"),
Vsn = proplists:get_value(vsn, Props),
ExpectedChangeLogLine = "## " ++ Vsn,
Expand Down
2 changes: 1 addition & 1 deletion test/ehttpc_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ no_body_but_headers_indicating_body_test_() ->
),
ok = ensure_not_error_response(Response2)
end
|| RequestType <- [put, post]
|| RequestType <- [put, post, patch]
]
end,
RequestsWithNoBody =
Expand Down

0 comments on commit e8d4f0d

Please sign in to comment.