mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
unify case clauses
This commit is contained in:
parent
c804ca4901
commit
eded22d1aa
1 changed files with 1 additions and 5 deletions
|
@ -332,11 +332,7 @@ stringify_allowed_methods(MethodList) when is_list(MethodList) ->
|
||||||
allowed_methods(Req, State=#state{method=Method}) ->
|
allowed_methods(Req, State=#state{method=Method}) ->
|
||||||
DefaultAllowedMethods = [<<"HEAD">>, <<"GET">>, <<"OPTIONS">>],
|
DefaultAllowedMethods = [<<"HEAD">>, <<"GET">>, <<"OPTIONS">>],
|
||||||
case call(Req, State, allowed_methods) of
|
case call(Req, State, allowed_methods) of
|
||||||
no_call when Method =:= <<"HEAD">>; Method =:= <<"GET">> ->
|
no_call when Method =:= <<"HEAD">>; Method =:= <<"GET">>; Method =:= <<"OPTIONS">> ->
|
||||||
Allow = stringify_allowed_methods(DefaultAllowedMethods),
|
|
||||||
Req2 = cowboy_req:set_resp_header(<<"allow">>, Allow, Req),
|
|
||||||
next(Req2, State, fun malformed_request/2);
|
|
||||||
no_call when Method =:= <<"OPTIONS">> ->
|
|
||||||
Allow = stringify_allowed_methods(DefaultAllowedMethods),
|
Allow = stringify_allowed_methods(DefaultAllowedMethods),
|
||||||
Req2 = cowboy_req:set_resp_header(<<"allow">>, Allow, Req),
|
Req2 = cowboy_req:set_resp_header(<<"allow">>, Allow, Req),
|
||||||
next(Req2, State, fun malformed_request/2);
|
next(Req2, State, fun malformed_request/2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue