aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_handler.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-05-01 01:59:36 +0200
committerLoïc Hoguin <[email protected]>2012-05-04 06:24:10 +0200
commit57fda142175a7fd0340d9030e0477c16e13dc5f5 (patch)
treea83701cdedf0a21b814fd3e78538d2473926e446 /test/http_handler.erl
parent7ed93fcc8f3fe42cbe22e96e3352b444c2480f74 (diff)
downloadcowboy-57fda142175a7fd0340d9030e0477c16e13dc5f5.tar.gz
cowboy-57fda142175a7fd0340d9030e0477c16e13dc5f5.tar.bz2
cowboy-57fda142175a7fd0340d9030e0477c16e13dc5f5.zip
Add an 'onresponse' hook
This new protocol option is a fun. It expects 3 args: the Status code used in the reply (this is the cowboy_http:status() type, it can be an integer or a binary), the headers that will be sent in the reply, and the Req. It should only return a possibly modified Req. This can be used for many things like error logging or custom error pages. If a reply is sent inside the hook, then Cowboy will discard the reply initially sent. Extra caution must be used in the handlers making use of inline chunked replies as they will throw an error. This fun cannot be used as a filter, you can either observe the reply sent or discard it to send a different one instead. The hook will not be called for replies sent from inside the hook.
Diffstat (limited to 'test/http_handler.erl')
0 files changed, 0 insertions, 0 deletions