aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/sse_mime_param_h.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/handlers/sse_mime_param_h.erl')
-rw-r--r--test/handlers/sse_mime_param_h.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/handlers/sse_mime_param_h.erl b/test/handlers/sse_mime_param_h.erl
new file mode 100644
index 0000000..7e0c0e9
--- /dev/null
+++ b/test/handlers/sse_mime_param_h.erl
@@ -0,0 +1,19 @@
+%% This module implements a loop handler that sends
+%% a lone id: line.
+
+-module(sse_mime_param_h).
+
+-export([init/2]).
+-export([info/3]).
+
+init(Req, State) ->
+ self() ! timeout,
+ {cowboy_loop, cowboy_req:stream_reply(200, #{
+ <<"content-type">> => <<"text/event-stream;encoding=UTF-8">>
+ }, Req), State}.
+
+info(timeout, Req, State) ->
+ cowboy_req:stream_events(#{
+ id => <<"hello">>
+ }, nofin, Req),
+ {stop, Req, State}.