mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Add specs for the cowboy_req:push/3,4 functions
This commit is contained in:
parent
83aa3f1b9c
commit
5fa5ba8ca4
1 changed files with 5 additions and 0 deletions
|
@ -94,6 +94,9 @@
|
||||||
| {sendfile, non_neg_integer(), pos_integer(), file:name_all()}.
|
| {sendfile, non_neg_integer(), pos_integer(), file:name_all()}.
|
||||||
-export_type([resp_body/0]).
|
-export_type([resp_body/0]).
|
||||||
|
|
||||||
|
-type push_opts() :: map(). %% @todo
|
||||||
|
-export_type([push_opts/0]).
|
||||||
|
|
||||||
-type req() :: map(). %% @todo #{
|
-type req() :: map(). %% @todo #{
|
||||||
% ref := ranch:ref(),
|
% ref := ranch:ref(),
|
||||||
% pid := pid(),
|
% pid := pid(),
|
||||||
|
@ -649,12 +652,14 @@ stream_body(Data, IsFin, #{pid := Pid, streamid := StreamID, has_sent_resp := he
|
||||||
Pid ! {{Pid, StreamID}, {data, IsFin, Data}},
|
Pid ! {{Pid, StreamID}, {data, IsFin, Data}},
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
-spec push(binary(), cowboy:http_headers(), req()) -> ok.
|
||||||
push(Path, Headers, Req) ->
|
push(Path, Headers, Req) ->
|
||||||
push(Path, Headers, Req, #{}).
|
push(Path, Headers, Req, #{}).
|
||||||
|
|
||||||
%% @todo Optimization: don't send anything at all for HTTP/1.0 and HTTP/1.1.
|
%% @todo Optimization: don't send anything at all for HTTP/1.0 and HTTP/1.1.
|
||||||
%% @todo Path, Headers, Opts, everything should be in proper binary,
|
%% @todo Path, Headers, Opts, everything should be in proper binary,
|
||||||
%% or normalized when creating the Req object.
|
%% or normalized when creating the Req object.
|
||||||
|
-spec push(binary(), cowboy:http_headers(), req(), push_opts()) -> ok.
|
||||||
push(Path, Headers, #{pid := Pid, streamid := StreamID,
|
push(Path, Headers, #{pid := Pid, streamid := StreamID,
|
||||||
scheme := Scheme0, host := Host0, port := Port0}, Opts) ->
|
scheme := Scheme0, host := Host0, port := Port0}, Opts) ->
|
||||||
Method = maps:get(method, Opts, <<"GET">>),
|
Method = maps:get(method, Opts, <<"GET">>),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue