diff --git a/test/h2spec_SUITE.erl b/test/h2spec_SUITE.erl index 28e3fa87..fe93fdcc 100644 --- a/test/h2spec_SUITE.erl +++ b/test/h2spec_SUITE.erl @@ -40,8 +40,8 @@ end_per_suite(_Config) -> init_dispatch() -> cowboy_router:compile([ - {"localhost", [ - {"/", hello_h, []} + {'_', [ + {"/", delay_hello_h, 500} ]} ]). diff --git a/test/handlers/delay_hello_h.erl b/test/handlers/delay_hello_h.erl new file mode 100644 index 00000000..7e59be69 --- /dev/null +++ b/test/handlers/delay_hello_h.erl @@ -0,0 +1,9 @@ +%% This module sends a hello world response after a delay. + +-module(delay_hello_h). + +-export([init/2]). + +init(Req, Delay) -> + timer:sleep(Delay), + {ok, cowboy_req:reply(200, #{}, <<"Hello world!">>, Req), Delay}.