0
Fork 0
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:
Loïc Hoguin 2012-11-29 11:18:57 +01:00
parent 7142016955
commit 6ec12f7ce8

View file

@ -217,6 +217,7 @@ rest_init(Req, Opts) ->
Directory1 = directory_path(Directory),
Mimetypes = proplists:get_value(mimetypes, Opts, []),
Mimetypes1 = case Mimetypes of
{{M, F}, E} -> {fun M:F/2, E};
{_, _} -> Mimetypes;
[] -> {fun path_to_mimetypes/2, []};
[_|_] -> {fun path_to_mimetypes/2, Mimetypes}