path: root/doc/src/guide
diff options
authorLoïc Hoguin <[email protected]>2017-11-01 16:27:26 +0000
committerLoïc Hoguin <[email protected]>2017-11-01 16:27:26 +0000
commit836342abb86b3ff15d1c8319a455d776f7027a87 (patch)
tree9d5fb1277006fac53920e8df80c144c7b45171d3 /doc/src/guide
parent5e88a9b394a2ae966ba95efadbf1cc24d060b457 (diff)
Add {switch_handler, Module} return value to cowboy_rest
Also {switch_handler, Module, Opts}. Allows switching to a different handler type. This is particularly useful for processing most of the request with cowboy_rest and then streaming the response body using cowboy_loop.
Diffstat (limited to 'doc/src/guide')
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/src/guide/rest_handlers.asciidoc b/doc/src/guide/rest_handlers.asciidoc
index c69f02b..dab5bea 100644
--- a/doc/src/guide/rest_handlers.asciidoc
+++ b/doc/src/guide/rest_handlers.asciidoc
@@ -43,8 +43,12 @@ you need.
All callbacks take two arguments, the Req object and the State,
and return a three-element tuple of the form `{Value, Req, State}`.
-All callbacks can also return `{stop, Req, State}` to stop execution
-of the request.
+Nearly all callbacks can also return `{stop, Req, State}` to
+stop execution of the request, and
+`{{switch_handler, Module}, Req, State}` or
+`{{switch_handler, Module, Opts}, Req, State}` to switch to
+a different handler type. The exceptions are `expires`
+`generate_etag`, `last_modified` and `variances`.
The following table summarizes the callbacks and their default values.
If the callback isn't defined, then the default value will be used.