mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
handle empty list when parsing allowed methods
This commit is contained in:
parent
eded22d1aa
commit
3bc7b08e3d
1 changed files with 6 additions and 2 deletions
|
@ -325,8 +325,12 @@ uri_too_long(Req, State) ->
|
|||
expect(Req, State, uri_too_long, false, fun allowed_methods/2, 414).
|
||||
|
||||
stringify_allowed_methods(MethodList) when is_list(MethodList) ->
|
||||
<< ", ", Allow/binary >> = << << ", ", M/binary >> || M <- MethodList >>,
|
||||
Allow.
|
||||
case MethodList of
|
||||
[] -> <<>>;
|
||||
_ ->
|
||||
<< ", ", Allow/binary >> = << << ", ", M/binary >> || M <- MethodList >>,
|
||||
Allow
|
||||
end.
|
||||
|
||||
%% allowed_methods/2 should return a list of binary methods.
|
||||
allowed_methods(Req, State=#state{method=Method}) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue