From a18ca0ae8ff76594c7b629f4340adab0a30954c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 24 Sep 2019 17:31:06 +0200 Subject: Reject requests/data when using Websocket --- test/ws_SUITE.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ws_SUITE.erl') diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index c672b22..4d2387b 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -70,6 +70,16 @@ error_http10_upgrade(Config) -> error(timeout) end. +error_http_request(Config) -> + doc("Ensure that requests are rejected while using Websocket."), + {ok, ConnPid} = gun:open("localhost", config(port, Config)), + {ok, _} = gun:await_up(ConnPid), + StreamRef1 = gun:ws_upgrade(ConnPid, "/", []), + {upgrade, [<<"websocket">>], _} = gun:await(ConnPid, StreamRef1), + StreamRef2 = gun:get(ConnPid, "/"), + {error, {connection_error, {badstate, _}}} = gun:await(ConnPid, StreamRef2), + gun:close(ConnPid). + reject_upgrade(Config) -> doc("Ensure Websocket connections can be rejected."), {ok, ConnPid} = gun:open("localhost", config(port, Config)), -- cgit v1.2.3