Browse Source

Fix a bug in REST when allowed_methods is defined when method is OPTIONS

Loïc Hoguin 12 years ago
parent
commit
68a365b85a
1 changed files with 1 additions and 2 deletions
  1. 1 2
      src/cowboy_rest.erl

+ 1 - 2
src/cowboy_rest.erl

@@ -136,8 +136,7 @@ allowed_methods(Req, State=#state{method=Method}) ->
 			State2 = State#state{handler_state=HandlerState},
 			State2 = State#state{handler_state=HandlerState},
 			case lists:member(Method, List) of
 			case lists:member(Method, List) of
 				true when Method =:= <<"OPTIONS">> ->
 				true when Method =:= <<"OPTIONS">> ->
-					next(Req2, State2#state{allowed_methods=
-						[<<"HEAD">>, <<"GET">>, <<"OPTIONS">>]},
+					next(Req2, State2#state{allowed_methods=List},
 						fun malformed_request/2);
 						fun malformed_request/2);
 				true ->
 				true ->
 					next(Req2, State2, fun malformed_request/2);
 					next(Req2, State2, fun malformed_request/2);