diff options
Diffstat (limited to 'src/cowboy_static.erl')
-rw-r--r-- | src/cowboy_static.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl index 5450115..724bf33 100644 --- a/src/cowboy_static.erl +++ b/src/cowboy_static.erl @@ -81,9 +81,9 @@ %% {<<".js">>, [<<"application/javascript">>]}]}]} %% %% %% Use the default database in the mimetypes application. -%% {[<<"static">>, '...', cowboy_static, +%% {[<<"static">>, '...'], cowboy_static, %% [{directory, {priv_dir, cowboy, []}}, -%% {mimetypes, {fun mimetypes:path_to_mimes/2, default}}]]} +%% {mimetypes, {fun mimetypes:path_to_mimes/2, default}}]} %% ''' %% %% == ETag Header Function == @@ -110,19 +110,19 @@ %% ==== Examples ==== %% ``` %% %% A value of default is equal to not specifying the option. -%% {[<<"static">>, '...', cowboy_static, +%% {[<<"static">>, '...'], cowboy_static, %% [{directory, {priv_dir, cowboy, []}}, -%% {etag, default}]]} +%% {etag, default}]} %% %% %% Use all avaliable ETag function arguments to generate a header value. -%% {[<<"static">>, '...', cowboy_static, +%% {[<<"static">>, '...'], cowboy_static, %% [{directory, {priv_dir, cowboy, []}}, -%% {etag, {attributes, [filepath, filesize, inode, mtime]}}]]} +%% {etag, {attributes, [filepath, filesize, inode, mtime]}}]} %% %% %% Use a user defined function to generate a strong ETag header value. -%% {[<<"static">>, '...', cowboy_static, +%% {[<<"static">>, '...'], cowboy_static, %% [{directory, {priv_dir, cowboy, []}}, -%% {etag, {fun generate_strong_etag/2, strong_etag_extra}}]]} +%% {etag, {fun generate_strong_etag/2, strong_etag_extra}}]} %% %% generate_strong_etag(Arguments, strong_etag_extra) -> %% {_, Filepath} = lists:keyfind(filepath, 1, Arguments), @@ -451,7 +451,7 @@ path_to_mimetypes(Filepath, Extensions) when is_binary(Filepath) -> -spec path_to_mimetypes_(binary(), [{binary(), [mimedef()]}]) -> [mimedef()]. path_to_mimetypes_(Ext, Extensions) -> - case lists:keyfind(Ext, 1, Extensions) of + case lists:keyfind(cowboy_bstr:to_lower(Ext), 1, Extensions) of {_, MTs} -> MTs; _Unknown -> default_mimetype() end. |