mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Make a few more missing headers lowercase
This commit is contained in:
parent
8bc6bde62f
commit
db6b1596ae
4 changed files with 15 additions and 15 deletions
|
@ -20,7 +20,7 @@ echo(<<"GET">>, undefined, Req) ->
|
||||||
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
|
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
|
||||||
echo(<<"GET">>, Echo, Req) ->
|
echo(<<"GET">>, Echo, Req) ->
|
||||||
cowboy_req:reply(200,
|
cowboy_req:reply(200,
|
||||||
[{<<"Content-Encoding">>, <<"utf-8">>}], Echo, Req);
|
[{<<"content-encoding">>, <<"utf-8">>}], Echo, Req);
|
||||||
echo(_, _, Req) ->
|
echo(_, _, Req) ->
|
||||||
%% Method not allowed.
|
%% Method not allowed.
|
||||||
cowboy_req:reply(405, Req).
|
cowboy_req:reply(405, Req).
|
||||||
|
|
|
@ -30,7 +30,7 @@ echo(undefined, Req) ->
|
||||||
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
|
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
|
||||||
echo(Echo, Req) ->
|
echo(Echo, Req) ->
|
||||||
cowboy_req:reply(200,
|
cowboy_req:reply(200,
|
||||||
[{<<"Content-Encoding">>, <<"utf-8">>}], Echo, Req).
|
[{<<"content-encoding">>, <<"utf-8">>}], Echo, Req).
|
||||||
|
|
||||||
terminate(_Req, _State) ->
|
terminate(_Req, _State) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
|
@ -115,7 +115,7 @@ cookie(Key, Value, Options) when is_binary(Key)
|
||||||
end,
|
end,
|
||||||
CookieParts = <<Cookie/binary, ExpiresPart/binary, SecurePart/binary,
|
CookieParts = <<Cookie/binary, ExpiresPart/binary, SecurePart/binary,
|
||||||
DomainPart/binary, PathPart/binary, HttpOnlyPart/binary>>,
|
DomainPart/binary, PathPart/binary, HttpOnlyPart/binary>>,
|
||||||
{<<"Set-Cookie">>, CookieParts}.
|
{<<"set-cookie">>, CookieParts}.
|
||||||
|
|
||||||
%% Internal.
|
%% Internal.
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ parse_cookie_test() ->
|
||||||
|
|
||||||
domain_test() ->
|
domain_test() ->
|
||||||
?assertEqual(
|
?assertEqual(
|
||||||
{<<"Set-Cookie">>,
|
{<<"set-cookie">>,
|
||||||
<<"Customer=WILE_E_COYOTE; "
|
<<"Customer=WILE_E_COYOTE; "
|
||||||
"Version=1; "
|
"Version=1; "
|
||||||
"Domain=acme.com; "
|
"Domain=acme.com; "
|
||||||
|
@ -368,7 +368,7 @@ domain_test() ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
local_time_test() ->
|
local_time_test() ->
|
||||||
{<<"Set-Cookie">>, B} = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>,
|
{<<"set-cookie">>, B} = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>,
|
||||||
[{max_age, 111}, {secure, true}]),
|
[{max_age, 111}, {secure, true}]),
|
||||||
|
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
|
@ -382,7 +382,7 @@ local_time_test() ->
|
||||||
|
|
||||||
-spec cookie_test() -> no_return(). %% Not actually true, just a bad option.
|
-spec cookie_test() -> no_return(). %% Not actually true, just a bad option.
|
||||||
cookie_test() ->
|
cookie_test() ->
|
||||||
C1 = {<<"Set-Cookie">>,
|
C1 = {<<"set-cookie">>,
|
||||||
<<"Customer=WILE_E_COYOTE; "
|
<<"Customer=WILE_E_COYOTE; "
|
||||||
"Version=1; "
|
"Version=1; "
|
||||||
"Path=/acme">>},
|
"Path=/acme">>},
|
||||||
|
@ -391,20 +391,20 @@ cookie_test() ->
|
||||||
C1 = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>,
|
C1 = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>,
|
||||||
[{path, <<"/acme">>}, {badoption, <<"negatory">>}]),
|
[{path, <<"/acme">>}, {badoption, <<"negatory">>}]),
|
||||||
|
|
||||||
{<<"Set-Cookie">>,<<"=NoKey; Version=1">>}
|
{<<"set-cookie">>,<<"=NoKey; Version=1">>}
|
||||||
= cookie(<<"">>, <<"NoKey">>, []),
|
= cookie(<<"">>, <<"NoKey">>, []),
|
||||||
{<<"Set-Cookie">>,<<"=NoKey; Version=1">>}
|
{<<"set-cookie">>,<<"=NoKey; Version=1">>}
|
||||||
= cookie(<<"">>, <<"NoKey">>),
|
= cookie(<<"">>, <<"NoKey">>),
|
||||||
LocalTime = calendar:universal_time_to_local_time(
|
LocalTime = calendar:universal_time_to_local_time(
|
||||||
{{2007, 5, 15}, {13, 45, 33}}),
|
{{2007, 5, 15}, {13, 45, 33}}),
|
||||||
C2 = {<<"Set-Cookie">>,
|
C2 = {<<"set-cookie">>,
|
||||||
<<"Customer=WILE_E_COYOTE; "
|
<<"Customer=WILE_E_COYOTE; "
|
||||||
"Version=1; "
|
"Version=1; "
|
||||||
"Expires=Tue, 15 May 2007 13:45:33 GMT; "
|
"Expires=Tue, 15 May 2007 13:45:33 GMT; "
|
||||||
"Max-Age=0">>},
|
"Max-Age=0">>},
|
||||||
C2 = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>,
|
C2 = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>,
|
||||||
[{max_age, -111}, {local_time, LocalTime}]),
|
[{max_age, -111}, {local_time, LocalTime}]),
|
||||||
C3 = {<<"Set-Cookie">>,
|
C3 = {<<"set-cookie">>,
|
||||||
<<"Customer=WILE_E_COYOTE; "
|
<<"Customer=WILE_E_COYOTE; "
|
||||||
"Version=1; "
|
"Version=1; "
|
||||||
"Expires=Wed, 16 May 2007 13:45:50 GMT; "
|
"Expires=Wed, 16 May 2007 13:45:50 GMT; "
|
||||||
|
|
|
@ -153,9 +153,9 @@ websocket_handshake(State=#state{socket=Socket, transport=Transport,
|
||||||
{<< "http", Location/binary >>, Req1} = cowboy_req:url(Req),
|
{<< "http", Location/binary >>, Req1} = cowboy_req:url(Req),
|
||||||
{ok, Req2} = cowboy_req:upgrade_reply(
|
{ok, Req2} = cowboy_req:upgrade_reply(
|
||||||
<<"101 WebSocket Protocol Handshake">>,
|
<<"101 WebSocket Protocol Handshake">>,
|
||||||
[{<<"Upgrade">>, <<"WebSocket">>},
|
[{<<"upgrade">>, <<"WebSocket">>},
|
||||||
{<<"Sec-Websocket-Location">>, << "ws", Location/binary >>},
|
{<<"sec-websocket-location">>, << "ws", Location/binary >>},
|
||||||
{<<"Sec-Websocket-Origin">>, Origin}],
|
{<<"sec-websocket-origin">>, Origin}],
|
||||||
Req1),
|
Req1),
|
||||||
%% Flush the resp_sent message before moving on.
|
%% Flush the resp_sent message before moving on.
|
||||||
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
|
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
|
||||||
|
@ -181,8 +181,8 @@ websocket_handshake(State=#state{transport=Transport, challenge=Challenge},
|
||||||
Req, HandlerState) ->
|
Req, HandlerState) ->
|
||||||
{ok, Req2} = cowboy_req:upgrade_reply(
|
{ok, Req2} = cowboy_req:upgrade_reply(
|
||||||
101,
|
101,
|
||||||
[{<<"Upgrade">>, <<"websocket">>},
|
[{<<"upgrade">>, <<"websocket">>},
|
||||||
{<<"Sec-Websocket-Accept">>, Challenge}],
|
{<<"sec-websocket-accept">>, Challenge}],
|
||||||
Req),
|
Req),
|
||||||
%% Flush the resp_sent message before moving on.
|
%% Flush the resp_sent message before moving on.
|
||||||
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
|
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue