diff options
author | Loïc Hoguin <[email protected]> | 2017-11-27 13:23:31 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-11-27 13:23:31 +0100 |
commit | 843b104fcb75bcd217359a8b02d0b1f263d42602 (patch) | |
tree | 41e14dfc5f312441f50a07b76bf51b629850b1d6 /test/handlers | |
parent | e71733232eddaeb41d4d3a8fbcba49ca7975da79 (diff) | |
download | cowboy-843b104fcb75bcd217359a8b02d0b1f263d42602.tar.gz cowboy-843b104fcb75bcd217359a8b02d0b1f263d42602.tar.bz2 cowboy-843b104fcb75bcd217359a8b02d0b1f263d42602.zip |
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.
Diffstat (limited to 'test/handlers')
-rw-r--r-- | test/handlers/delay_hello_h.erl | 9 |
1 files changed, 9 insertions, 0 deletions
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}. |