diff options
author | Loïc Hoguin <[email protected]> | 2018-08-09 15:03:55 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-08-09 15:03:55 +0200 |
commit | f3149399815257b934ca5c47c9b9f2d9de198bc6 (patch) | |
tree | 7221cbe2f5de613162559531fd5e5c7fbec7de4b /test/handlers | |
parent | a66484cf97db7ce3fc56b9e8f23b93a4e3da03ec (diff) | |
download | gun-f3149399815257b934ca5c47c9b9f2d9de198bc6.tar.gz gun-f3149399815257b934ca5c47c9b9f2d9de198bc6.tar.bz2 gun-f3149399815257b934ca5c47c9b9f2d9de198bc6.zip |
Add an SSE test for lone id: lines
Diffstat (limited to 'test/handlers')
-rw-r--r-- | test/handlers/sse_lone_id_h.erl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/handlers/sse_lone_id_h.erl b/test/handlers/sse_lone_id_h.erl new file mode 100644 index 0000000..3684fa9 --- /dev/null +++ b/test/handlers/sse_lone_id_h.erl @@ -0,0 +1,19 @@ +%% This module implements a loop handler that sends +%% a lone id: line. + +-module(sse_lone_id_h). + +-export([init/2]). +-export([info/3]). + +init(Req, State) -> + self() ! timeout, + {cowboy_loop, cowboy_req:stream_reply(200, #{ + <<"content-type">> => <<"text/event-stream">> + }, Req), State}. + +info(timeout, Req, State) -> + cowboy_req:stream_events(#{ + id => <<"hello">> + }, nofin, Req), + {stop, Req, State}. |