diff options
author | FabioBatSilva <[email protected]> | 2016-02-22 11:10:15 -0500 |
---|---|---|
committer | FabioBatSilva <[email protected]> | 2016-02-22 11:10:15 -0500 |
commit | 0285ef94ab4d021c6bbfbe12ce6d3c1fa3c0cdda (patch) | |
tree | 07b10bcab52660a546e4d58f6c3409e45c76dd13 /lib/inets | |
parent | 0f6b42953eceb250dcdb61611154cc276895ea85 (diff) | |
download | otp-0285ef94ab4d021c6bbfbe12ce6d3c1fa3c0cdda.tar.gz otp-0285ef94ab4d021c6bbfbe12ce6d3c1fa3c0cdda.tar.bz2 otp-0285ef94ab4d021c6bbfbe12ce6d3c1fa3c0cdda.zip |
inets: Add DELETE Body to client
Diffstat (limited to 'lib/inets')
-rw-r--r-- | lib/inets/src/http_client/httpc_request.erl | 3 | ||||
-rw-r--r-- | lib/inets/test/httpc_SUITE.erl | 24 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/inets/src/http_client/httpc_request.erl b/lib/inets/src/http_client/httpc_request.erl index 5c2d31ee57..8fcfbc30c0 100644 --- a/lib/inets/src/http_client/httpc_request.erl +++ b/lib/inets/src/http_client/httpc_request.erl @@ -189,7 +189,8 @@ is_client_closing(Headers) -> post_data(Method, Headers, {ContentType, Body}, HeadersAsIs) when (Method =:= post) orelse (Method =:= put) - orelse (Method =:= patch) -> + orelse (Method =:= patch) + orelse (Method =:= delete) -> NewBody = case Headers#http_request_h.expect of "100-continue" -> diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 93b96e101f..f9b3aa5b59 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -67,6 +67,7 @@ real_requests()-> head, get, post, + delete, post_stream, patch, async, @@ -256,6 +257,29 @@ post(Config) when is_list(Config) -> {ok, {{_,504,_}, [_ | _], []}} = httpc:request(post, {URL, [{"expect","100-continue"}], "text/plain", "foobar"}, [], []). +%%-------------------------------------------------------------------- +delete() -> + [{"Test http delete request against local server. We do in this case " + "only care about the client side of the the delete. The server " + "script will not actually use the delete data."}]. +delete(Config) when is_list(Config) -> + CGI = case test_server:os_type() of + {win32, _} -> + "/cgi-bin/cgi_echo.exe"; + _ -> + "/cgi-bin/cgi_echo" + end, + + URL = url(group_name(Config), CGI, Config), + Body = lists:duplicate(100, "1"), + + {ok, {{_,200,_}, [_ | _], [_ | _]}} = + httpc:request(delete, {URL, [{"expect","100-continue"}], + "text/plain", Body}, [], []), + + {ok, {{_,504,_}, [_ | _], []}} = + httpc:request(delete, {URL, [{"expect","100-continue"}], + "text/plain", "foobar"}, [], []). %%-------------------------------------------------------------------- patch() -> |