From 427a276ef2f2042ad312e0260535cbb4696f9072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 23 Jan 2024 13:15:55 +0100 Subject: 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. --- doc/src/guide/resource_design.asciidoc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'doc/src/guide/resource_design.asciidoc') diff --git a/doc/src/guide/resource_design.asciidoc b/doc/src/guide/resource_design.asciidoc index 954d87d..125b437 100644 --- a/doc/src/guide/resource_design.asciidoc +++ b/doc/src/guide/resource_design.asciidoc @@ -144,6 +144,16 @@ never be called. Implement the `languages_provided` or `charsets_provided` callbacks if applicable. +Does the resource accept ranged requests? If it does, +implement the `ranges_provided` callback. Resources that +only accept `bytes` units can use the callback name +`auto` and let Cowboy automatically do ranged responses. +Other callbacks should have a name prefix of `ranged_` +for clarity. For example, `ranged_bytes` or `ranged_pages`. +If the resource needs to perform additional checks before +accepting to do a ranged responses, implement the +`range_satisfiable` callback. + Is there any other header that may make the representation of the resource vary? Implement the `variances` callback. @@ -191,10 +201,15 @@ the `options` method. === GET and HEAD methods If you implement the methods GET and/or HEAD, you must -implement one `ProvideResource` callback for each +implement one `ProvideCallback` callback for each content-type returned by the `content_types_provided` callback. +When range requests are accepted, you must implement one +`RangeCallback` for each range unit returned by +`ranges_provided` (unless `auto` was used). This is +in addition to the `ProvideCallback` callback. + === PUT, POST and PATCH methods If you implement the methods PUT, POST and/or PATCH, -- cgit v1.2.3