Skip to content

Commit

Permalink
unify case clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksilva97 committed Feb 6, 2024
1 parent c804ca4 commit eded22d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/cowboy_rest.erl
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,7 @@ stringify_allowed_methods(MethodList) when is_list(MethodList) ->
allowed_methods(Req, State=#state{method=Method}) ->
DefaultAllowedMethods = [<<"HEAD">>, <<"GET">>, <<"OPTIONS">>],
case call(Req, State, allowed_methods) of
no_call when Method =:= <<"HEAD">>; Method =:= <<"GET">> ->
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">> ->
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);
Expand Down

0 comments on commit eded22d

Please sign in to comment.