aboutsummaryrefslogtreecommitdiffstats
path: root/test/ws_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-09-24 17:31:06 +0200
committerLoïc Hoguin <[email protected]>2019-09-24 17:31:06 +0200
commita18ca0ae8ff76594c7b629f4340adab0a30954c4 (patch)
tree55ff6fb6852c0c98bca9362adf71dd7cc9eb89c4 /test/ws_SUITE.erl
parenta3c2edbb8c807717e2f10520c6cf1e77a62eab2e (diff)
downloadgun-a18ca0ae8ff76594c7b629f4340adab0a30954c4.tar.gz
gun-a18ca0ae8ff76594c7b629f4340adab0a30954c4.tar.bz2
gun-a18ca0ae8ff76594c7b629f4340adab0a30954c4.zip
Reject requests/data when using Websocket
Diffstat (limited to 'test/ws_SUITE.erl')
-rw-r--r--test/ws_SUITE.erl10
1 files changed, 10 insertions, 0 deletions
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)),