diff options
author | Loïc Hoguin <[email protected]> | 2019-07-02 17:28:44 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-07-02 17:29:40 +0200 |
commit | 4a6503186bf3a72880e7c99be76406550aeded96 (patch) | |
tree | 3be68b90bc7813fc87a0ac6167793842fa4557d5 /test/handlers/stream_h.erl | |
parent | 1c03ef37c3b9060db8483e3870771d900e176c97 (diff) | |
download | gun-4a6503186bf3a72880e7c99be76406550aeded96.tar.gz gun-4a6503186bf3a72880e7c99be76406550aeded96.tar.bz2 gun-4a6503186bf3a72880e7c99be76406550aeded96.zip |
Add response_inform/response_headers/response_end events
This covers many scenarios but more need to be added.
Diffstat (limited to 'test/handlers/stream_h.erl')
-rw-r--r-- | test/handlers/stream_h.erl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/handlers/stream_h.erl b/test/handlers/stream_h.erl new file mode 100644 index 0000000..fd6774e --- /dev/null +++ b/test/handlers/stream_h.erl @@ -0,0 +1,14 @@ +%% Feel free to use, reuse and abuse the code in this file. + +-module(stream_h). + +-export([init/2]). + +init(Req0, State) -> + Req = cowboy_req:stream_reply(200, #{ + <<"content-type">> => <<"text/plain">> + }, Req0), + cowboy_req:stream_body(<<"Hello ">>, nofin, Req), + cowboy_req:stream_body(<<"world!">>, nofin, Req), + %% The stream will be closed by Cowboy. + {ok, Req, State}. |