0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

fix: cowboy_static misc specs

This commit is contained in:
Marko Mindek 2025-01-08 13:30:14 +01:00
parent 7ca06ffac5
commit de07b0b267

View file

@ -347,7 +347,7 @@ content_types_provided(Req, State={Path, _, Extra}) when is_list(Extra) ->
%% Detect the charset of the file. %% Detect the charset of the file.
-spec charsets_provided(Req, State) -spec charsets_provided(Req, State)
-> {[binary()], Req, State} -> {[binary()], Req, State} | no_call
when State::state(). when State::state().
charsets_provided(Req, State={Path, _, Extra}) -> charsets_provided(Req, State={Path, _, Extra}) ->
case lists:keyfind(charset, 1, Extra) of case lists:keyfind(charset, 1, Extra) of
@ -381,7 +381,7 @@ resource_exists(Req, State) ->
%% Generate an etag for the file. %% Generate an etag for the file.
-spec generate_etag(Req, State) -spec generate_etag(Req, State)
-> {{strong | weak, binary()}, Req, State} -> {{strong | weak, binary() | undefined}, Req, State}
when State::state(). when State::state().
generate_etag(Req, State={Path, {_, #file_info{size=Size, mtime=Mtime}}, generate_etag(Req, State={Path, {_, #file_info{size=Size, mtime=Mtime}},
Extra}) -> Extra}) ->
@ -408,7 +408,7 @@ last_modified(Req, State={_, {_, #file_info{mtime=Modified}}, _}) ->
%% Stream the file. %% Stream the file.
-spec get_file(Req, State) -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(). when State::state().
get_file(Req, State={Path, {direct, #file_info{size=Size}}, _}) -> get_file(Req, State={Path, {direct, #file_info{size=Size}}, _}) ->
{{sendfile, 0, Size, Path}, Req, State}; {{sendfile, 0, Size, Path}, Req, State};