0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 12:40:25 +00:00

Improve consistency of return types for cowboy_req API

The signature of parse_header, body_qs, multipart_data and
the set_resp_* functions has changed.

See the cowboy_req module edoc for more details.
This commit is contained in:
Loïc Hoguin 2012-09-16 03:51:07 +02:00
parent e13ab806ea
commit 8d5f8db90a
9 changed files with 116 additions and 103 deletions

View file

@ -71,11 +71,11 @@ upgrade(ListenerPid, Handler, Opts, Req) ->
-spec websocket_upgrade(#state{}, Req)
-> {ok, #state{}, Req} when Req::cowboy_req:req().
websocket_upgrade(State, Req) ->
{ConnTokens, Req2}
{ok, ConnTokens, Req2}
= cowboy_req:parse_header('Connection', Req),
true = lists:member(<<"upgrade">>, ConnTokens),
%% @todo Should probably send a 426 if the Upgrade header is missing.
{[<<"websocket">>], Req3} = cowboy_req:parse_header('Upgrade', Req2),
{ok, [<<"websocket">>], Req3} = cowboy_req:parse_header('Upgrade', Req2),
{Version, Req4} = cowboy_req:header(<<"Sec-Websocket-Version">>, Req3),
websocket_upgrade(Version, State, Req4).