mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
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.
This commit is contained in:
parent
e71733232e
commit
843b104fcb
2 changed files with 11 additions and 2 deletions
|
@ -40,8 +40,8 @@ end_per_suite(_Config) ->
|
|||
|
||||
init_dispatch() ->
|
||||
cowboy_router:compile([
|
||||
{"localhost", [
|
||||
{"/", hello_h, []}
|
||||
{'_', [
|
||||
{"/", delay_hello_h, 500}
|
||||
]}
|
||||
]).
|
||||
|
||||
|
|
9
test/handlers/delay_hello_h.erl
Normal file
9
test/handlers/delay_hello_h.erl
Normal file
|
@ -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}.
|
Loading…
Add table
Add a link
Reference in a new issue