aboutsummaryrefslogtreecommitdiffstats
path: root/test/rfc7230_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-19 09:29:21 +0100
committerLoïc Hoguin <[email protected]>2018-11-19 09:29:21 +0100
commitd2f367fba3a44101ccc333d83ab0c889cca2317b (patch)
treef182a4ef949c9b93069d45a0cf4ea439d6ffb270 /test/rfc7230_SUITE.erl
parentbed328b6c9ce41782c340a89554599a838574d82 (diff)
downloadcowboy-d2f367fba3a44101ccc333d83ab0c889cca2317b.tar.gz
cowboy-d2f367fba3a44101ccc333d83ab0c889cca2317b.tar.bz2
cowboy-d2f367fba3a44101ccc333d83ab0c889cca2317b.zip
Use try..after in tests that start their own listeners
Diffstat (limited to 'test/rfc7230_SUITE.erl')
-rw-r--r--test/rfc7230_SUITE.erl21
1 files changed, 12 insertions, 9 deletions
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)