From d2f367fba3a44101ccc333d83ab0c889cca2317b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 19 Nov 2018 09:29:21 +0100 Subject: Use try..after in tests that start their own listeners --- test/rfc7230_SUITE.erl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'test/rfc7230_SUITE.erl') diff --git a/test/rfc7230_SUITE.erl b/test/rfc7230_SUITE.erl index d42a454..17ff452 100644 --- a/test/rfc7230_SUITE.erl +++ b/test/rfc7230_SUITE.erl @@ -1593,15 +1593,18 @@ empty_host(Config0) -> Config = cowboy_test:init_http(?FUNCTION_NAME, #{ env => #{dispatch => cowboy_router:compile(Routes)} }, Config0), - #{code := 200, body := <<>>} = do_raw(Config, [ - "GET /echo/host HTTP/1.1\r\n" - "Host:\r\n" - "\r\n"]), - #{code := 200, body := <<>>} = do_raw(Config, [ - "GET /echo/host HTTP/1.1\r\n" - "Host: \r\n" - "\r\n"]), - cowboy:stop_listener(?FUNCTION_NAME). + try + #{code := 200, body := <<>>} = do_raw(Config, [ + "GET /echo/host HTTP/1.1\r\n" + "Host:\r\n" + "\r\n"]), + #{code := 200, body := <<>>} = do_raw(Config, [ + "GET /echo/host HTTP/1.1\r\n" + "Host: \r\n" + "\r\n"]) + after + cowboy:stop_listener(?FUNCTION_NAME) + end. %% The effective request URI can be rebuilt by concatenating scheme, %% "://", authority, path and query components. (RFC7230 5.5) -- cgit v1.2.3