diff options
author | rinpatch <[email protected]> | 2020-09-24 00:06:51 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-10-07 11:12:59 +0200 |
commit | c2c0203a5c1e8bcf14b7a26d53c3cb7cc6fd565b (patch) | |
tree | 758d20bf40a2046a5146b7f6954cdee60bfd2f46 /test | |
parent | 2f4046c13213ed2cd7d51d6422e74170bf22d2fc (diff) | |
download | gun-c2c0203a5c1e8bcf14b7a26d53c3cb7cc6fd565b.tar.gz gun-c2c0203a5c1e8bcf14b7a26d53c3cb7cc6fd565b.tar.bz2 gun-c2c0203a5c1e8bcf14b7a26d53c3cb7cc6fd565b.zip |
Normalize headers in ws_upgrade
In the documentation headers passed to ws_upgrade are typed as
gun:req_headers(), however if a map of headers is passed (which is
allowed by the type), the gun process will crash when trying to operate
on it as if it were a list.
Diffstat (limited to 'test')
-rw-r--r-- | test/ws_SUITE.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index d4413fb..c04acc2 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -70,6 +70,17 @@ error_http10_upgrade(Config) -> error(timeout) end. +headers_normalized_upgrade(Config) -> + doc("Headers passed to ws_upgrade are normalized before being used."), + {ok, ConnPid} = gun:open("localhost", config(port, Config)), + {ok, _} = gun:await_up(ConnPid), + StreamRef = gun:ws_upgrade(ConnPid, "/", #{ + atom_header_name => <<"value">>, + "string_header_name" => <<"value">> + }), + {upgrade, [<<"websocket">>], _} = gun:await(ConnPid, StreamRef), + gun:close(ConnPid). + error_http_request(Config) -> doc("Ensure that requests are rejected while using Websocket."), {ok, ConnPid} = gun:open("localhost", config(port, Config)), |