diff options
author | Loïc Hoguin <[email protected]> | 2013-01-29 19:12:34 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-01-29 19:12:34 +0100 |
commit | 85d05fff340198bb9af332b7fd503f7c8883e634 (patch) | |
tree | 2a6aa9f28c0062d2b9167f441e0f4e5046993154 /test | |
parent | ab0699ab29b6750d19cf2e0fce03e185d2206e9d (diff) | |
download | cowboy-85d05fff340198bb9af332b7fd503f7c8883e634.tar.gz cowboy-85d05fff340198bb9af332b7fd503f7c8883e634.tar.bz2 cowboy-85d05fff340198bb9af332b7fd503f7c8883e634.zip |
Fix chunked streaming of request body and improve speed
Diffstat (limited to 'test')
-rw-r--r-- | test/http_SUITE.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 25ce595..637bb0d 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -73,6 +73,7 @@ -export([stream_body_set_resp/1]). -export([stream_body_set_resp_close/1]). -export([te_chunked/1]). +-export([te_chunked_chopped/1]). -export([te_chunked_delayed/1]). -export([te_identity/1]). @@ -133,6 +134,7 @@ groups() -> stream_body_set_resp, stream_body_set_resp_close, te_chunked, + te_chunked_chopped, te_chunked_delayed, te_identity ], @@ -1037,6 +1039,21 @@ te_chunked(Config) -> {ok, 200, _, Client3} = cowboy_client:response(Client2), {ok, Body, _} = cowboy_client:response_body(Client3). +te_chunked_chopped(Config) -> + Client = ?config(client, Config), + Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])), + Body2 = iolist_to_binary(body_to_chunks(50, Body, [])), + {ok, Client2} = cowboy_client:request(<<"GET">>, + build_url("/echo/body", Config), + [{<<"transfer-encoding">>, <<"chunked">>}], Client), + {ok, Transport, Socket} = cowboy_client:transport(Client2), + _ = [begin + ok = Transport:send(Socket, << C >>), + ok = timer:sleep(10) + end || << C >> <= Body2], + {ok, 200, _, Client3} = cowboy_client:response(Client2), + {ok, Body, _} = cowboy_client:response_body(Client3). + te_chunked_delayed(Config) -> Client = ?config(client, Config), Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])), |