aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_protocol.erl12
-rw-r--r--src/cowboy_req.erl3
2 files changed, 10 insertions, 5 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl
index f4cbed5..2e734c5 100644
--- a/src/cowboy_protocol.erl
+++ b/src/cowboy_protocol.erl
@@ -46,15 +46,21 @@
-include_lib("eunit/include/eunit.hrl").
-endif.
+-type onrequest_fun() :: fun((Req) -> Req).
+-type onresponse_fun() ::
+ fun((cowboy_http:status(), cowboy_http:headers(), Req) -> Req).
+
+-export_type([onrequest_fun/0]).
+-export_type([onresponse_fun/0]).
+
-record(state, {
listener :: pid(),
socket :: inet:socket(),
transport :: module(),
dispatch :: cowboy_dispatcher:dispatch_rules(),
handler :: {module(), any()},
- onrequest :: undefined | fun((cowboy_req:req()) -> cowboy_req:req()),
- onresponse = undefined :: undefined | fun((cowboy_http:status(),
- cowboy_http:headers(), cowboy_req:req()) -> cowboy_req:req()),
+ onrequest :: undefined | onrequest_fun(),
+ onresponse = undefined :: undefined | onresponse_fun(),
urldecode :: {fun((binary(), T) -> binary()), T},
req_empty_lines = 0 :: integer(),
max_empty_lines :: integer(),
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index d0aa3c6..f8e0b6a 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -158,8 +158,7 @@
| {non_neg_integer(), fun(() -> {sent, non_neg_integer()})},
%% Functions.
- onresponse = undefined :: undefined | fun((cowboy_http:status(),
- cowboy_http:headers(), Req) -> Req),
+ onresponse = undefined :: undefined | cowboy_protocol:onresponse_fun(),
urldecode :: {fun((binary(), T) -> binary()), T}
}).