diff options
author | Loïc Hoguin <[email protected]> | 2024-01-23 13:15:55 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2024-01-23 13:15:55 +0100 |
commit | 427a276ef2f2042ad312e0260535cbb4696f9072 (patch) | |
tree | e9db446291ce814fa2bcc1b4570a6221625890e3 /doc/src/guide/rest_flowcharts.asciidoc | |
parent | 4ffcbfbf43b317c95e920b0a77e04dc411af79ec (diff) | |
download | cowboy-427a276ef2f2042ad312e0260535cbb4696f9072.tar.gz cowboy-427a276ef2f2042ad312e0260535cbb4696f9072.tar.bz2 cowboy-427a276ef2f2042ad312e0260535cbb4696f9072.zip |
Update the guide with range requests support
Also update the list of headers cowboy_rest might set
and tweak a small number of other items.
Diffstat (limited to 'doc/src/guide/rest_flowcharts.asciidoc')
-rw-r--r-- | doc/src/guide/rest_flowcharts.asciidoc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/doc/src/guide/rest_flowcharts.asciidoc b/doc/src/guide/rest_flowcharts.asciidoc index 308a919..b8d0e0d 100644 --- a/doc/src/guide/rest_flowcharts.asciidoc +++ b/doc/src/guide/rest_flowcharts.asciidoc @@ -95,6 +95,11 @@ callback will only be called at the end of the "GET and HEAD methods" diagram, when all conditions have been met. +Optionally, the `ranges_provided` also returns the +name of a callback for every range unit it accepts. This +will be called at the end of the "GET and HEAD methods" +diagram in the case of ranged requests. + The selected content-type, language and charset are saved as meta values in the Req object. You *should* use the appropriate representation if you set a @@ -121,11 +126,18 @@ succeed, the resource can be retrieved. Cowboy prepares the response by first retrieving metadata about the representation, then by calling -the `ProvideResource` callback. This is the callback +the `ProvideCallback` callback. This is the callback you defined for each content-types you returned from `content_types_provided`. This callback returns the body -that will be sent back to the client, or a fun if the -body must be streamed. +that will be sent back to the client. + +For ranged requests, but only when the `ranges_provided` +callback was defined earlier, Cowboy will add the selected +`range` information to the Req object and call the +`range_satisfiable` callback. After confirming that the +range can be provided, Cowboy calls the `RangeResource` +callback and produces a ranged response using the +ranged data from the callback. When the resource does not exist, Cowboy will figure out whether the resource existed previously, and if so whether |