aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/delayed_push_h.erl
blob: dbb8e56d64f571b1330d1b2247088377f6a2527b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
%% Feel free to use, reuse and abuse the code in this file.

-module(delayed_push_h).

-export([init/2]).

init(Req, Timeout) ->
	timer:sleep(Timeout),
	cowboy_req:push("/", #{<<"accept">> => <<"text/plain">>}, Req),
	cowboy_req:push("/empty", #{<<"accept">> => <<"text/plain">>}, Req),
	{ok, cowboy_req:reply(200, #{
		<<"content-type">> => <<"text/plain">>
	}, <<"Hello world!">>, Req), Timeout}.