mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix echo_post example
This commit is contained in:
parent
1470f88319
commit
4ced1d0994
3 changed files with 31 additions and 9 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue