From 843b104fcb75bcd217359a8b02d0b1f263d42602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 27 Nov 2017 13:23:31 +0100 Subject: Don't send the response immediately when using h2spec In some cases we were sending a response faster than h2spec was sending us the test case data, resulting in the request being processed successfully instead of failing as expected. --- test/handlers/delay_hello_h.erl | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/handlers/delay_hello_h.erl (limited to 'test/handlers') diff --git a/test/handlers/delay_hello_h.erl b/test/handlers/delay_hello_h.erl new file mode 100644 index 0000000..7e59be6 --- /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}. -- cgit v1.2.3