mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
static: Allow passing the mimetype fun as a {M, F} tuple
This commit is contained in:
parent
7142016955
commit
6ec12f7ce8
1 changed files with 1 additions and 0 deletions
|
@ -217,6 +217,7 @@ rest_init(Req, Opts) ->
|
||||||
Directory1 = directory_path(Directory),
|
Directory1 = directory_path(Directory),
|
||||||
Mimetypes = proplists:get_value(mimetypes, Opts, []),
|
Mimetypes = proplists:get_value(mimetypes, Opts, []),
|
||||||
Mimetypes1 = case Mimetypes of
|
Mimetypes1 = case Mimetypes of
|
||||||
|
{{M, F}, E} -> {fun M:F/2, E};
|
||||||
{_, _} -> Mimetypes;
|
{_, _} -> Mimetypes;
|
||||||
[] -> {fun path_to_mimetypes/2, []};
|
[] -> {fun path_to_mimetypes/2, []};
|
||||||
[_|_] -> {fun path_to_mimetypes/2, Mimetypes}
|
[_|_] -> {fun path_to_mimetypes/2, Mimetypes}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue