diff options
author | Marko Mindek <[email protected]> | 2025-01-08 12:06:16 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-01-23 15:07:10 +0100 |
commit | f071d772ede81981291cdb8e9f9c41981e131e57 (patch) | |
tree | 201c9122d8a1980e7228415f6ce0affb8cfdbd03 | |
parent | 662f6af98269f78460cf6749f49f241156520e13 (diff) | |
download | cowboy-f071d772ede81981291cdb8e9f9c41981e131e57.tar.gz cowboy-f071d772ede81981291cdb8e9f9c41981e131e57.tar.bz2 cowboy-f071d772ede81981291cdb8e9f9c41981e131e57.zip |
Fix a few underspec'd types in cowboy_static
-rw-r--r-- | src/cowboy_static.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl index a185ef1..8ea88f0 100644 --- a/src/cowboy_static.erl +++ b/src/cowboy_static.erl @@ -29,7 +29,7 @@ -type extra_charset() :: {charset, module(), function()} | {charset, binary()}. -type extra_etag() :: {etag, module(), function()} | {etag, false}. -type extra_mimetypes() :: {mimetypes, module(), function()} - | {mimetypes, binary() | {binary(), binary(), [{binary(), binary()}]}}. + | {mimetypes, binary() | {binary(), binary(), '*' | [{binary(), binary()}]}}. -type extra() :: [extra_charset() | extra_etag() | extra_mimetypes()]. -type opts() :: {file | dir, string() | binary()} | {file | dir, string() | binary(), extra()} @@ -332,7 +332,7 @@ forbidden(Req, State) -> %% Detect the mimetype of the file. -spec content_types_provided(Req, State) - -> {[{binary(), get_file}], Req, State} + -> {[{binary() | {binary(), binary(), '*' | [{binary(), binary()}]}, get_file}], Req, State} when State::state(). content_types_provided(Req, State={Path, _, Extra}) when is_list(Extra) -> case lists:keyfind(mimetypes, 1, Extra) of @@ -347,7 +347,7 @@ content_types_provided(Req, State={Path, _, Extra}) when is_list(Extra) -> %% Detect the charset of the file. -spec charsets_provided(Req, State) - -> {[binary()], Req, State} + -> {[binary()], Req, State} | no_call when State::state(). charsets_provided(Req, State={Path, _, Extra}) -> case lists:keyfind(charset, 1, Extra) of @@ -381,7 +381,7 @@ resource_exists(Req, State) -> %% Generate an etag for the file. -spec generate_etag(Req, State) - -> {{strong | weak, binary()}, Req, State} + -> {{strong | weak, binary() | undefined}, Req, State} when State::state(). generate_etag(Req, State={Path, {_, #file_info{size=Size, mtime=Mtime}}, Extra}) -> @@ -408,7 +408,7 @@ last_modified(Req, State={_, {_, #file_info{mtime=Modified}}, _}) -> %% Stream the file. -spec get_file(Req, State) - -> {{sendfile, 0, non_neg_integer(), binary()}, Req, State} + -> {{sendfile, 0, non_neg_integer(), binary()} | binary(), Req, State} when State::state(). get_file(Req, State={Path, {direct, #file_info{size=Size}}, _}) -> {{sendfile, 0, Size, Path}, Req, State}; |