aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-06-08 23:35:02 +0200
committerLoïc Hoguin <[email protected]>2016-06-08 23:35:02 +0200
commit4ced1d09943a2f1a9e22426904560e93d41bb8bf (patch)
tree55f7969d140667bfd172db992e8a3164688c4e8f /test
parent1470f8831988845efa07091e452cd0bede09d7b6 (diff)
downloadcowboy-4ced1d09943a2f1a9e22426904560e93d41bb8bf.tar.gz
cowboy-4ced1d09943a2f1a9e22426904560e93d41bb8bf.tar.bz2
cowboy-4ced1d09943a2f1a9e22426904560e93d41bb8bf.zip
Fix echo_post example
Diffstat (limited to 'test')
-rw-r--r--test/examples_SUITE.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/examples_SUITE.erl b/test/examples_SUITE.erl
index a461d79..fb95f3b 100644
--- a/test/examples_SUITE.erl
+++ b/test/examples_SUITE.erl
@@ -111,3 +111,22 @@ do_echo_get(Transport, Protocol, Config) ->
{response, nofin, 200, _} = gun:await(ConnPid, Ref),
{ok, <<"this is fun">>} = gun:await_body(ConnPid, Ref),
ok.
+
+echo_post(Config) ->
+ doc("POST parameter echo example."),
+ try
+ do_compile_and_start(echo_post),
+ do_echo_post(tcp, http, Config),
+ do_echo_post(tcp, http2, Config)
+ after
+ do_stop(echo_post)
+ end.
+
+do_echo_post(Transport, Protocol, Config) ->
+ ConnPid = gun_open([{port, 8080}, {type, Transport}, {protocol, Protocol}|Config]),
+ Ref = gun:post(ConnPid, "/", [
+ {<<"content-type">>, <<"application/octet-stream">>}
+ ], <<"echo=this+is+fun">>),
+ {response, nofin, 200, _} = gun:await(ConnPid, Ref),
+ {ok, <<"this is fun">>} = gun:await_body(ConnPid, Ref),
+ ok.