diff options
author | Loïc Hoguin <[email protected]> | 2016-08-10 17:52:44 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-10 17:52:44 +0200 |
commit | 5fa5ba8ca494072a3d1f72ca8df6ffce984f2237 (patch) | |
tree | 9c4744b88f8180e70e51609e124ccdff510f3757 | |
parent | 83aa3f1b9c7aeafaed2b798f75bea929e5090ed0 (diff) | |
download | cowboy-5fa5ba8ca494072a3d1f72ca8df6ffce984f2237.tar.gz cowboy-5fa5ba8ca494072a3d1f72ca8df6ffce984f2237.tar.bz2 cowboy-5fa5ba8ca494072a3d1f72ca8df6ffce984f2237.zip |
Add specs for the cowboy_req:push/3,4 functions
-rw-r--r-- | src/cowboy_req.erl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index d838c8c..79ab062 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -94,6 +94,9 @@ | {sendfile, non_neg_integer(), pos_integer(), file:name_all()}. -export_type([resp_body/0]). +-type push_opts() :: map(). %% @todo +-export_type([push_opts/0]). + -type req() :: map(). %% @todo #{ % ref := ranch:ref(), % pid := pid(), @@ -649,12 +652,14 @@ stream_body(Data, IsFin, #{pid := Pid, streamid := StreamID, has_sent_resp := he Pid ! {{Pid, StreamID}, {data, IsFin, Data}}, ok. +-spec push(binary(), cowboy:http_headers(), req()) -> ok. 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 Path, Headers, Opts, everything should be in proper binary, %% or normalized when creating the Req object. +-spec push(binary(), cowboy:http_headers(), req(), push_opts()) -> ok. push(Path, Headers, #{pid := Pid, streamid := StreamID, scheme := Scheme0, host := Host0, port := Port0}, Opts) -> Method = maps:get(method, Opts, <<"GET">>), |