aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2024-01-16 16:28:52 +0100
committerLoïc Hoguin <[email protected]>2024-01-16 16:28:52 +0100
commitdefce46fdf85d16bbe3c0a8de6058334e8a53775 (patch)
treed26ddce251a9f633b7cd20684e9eb3b8e97d40d4 /doc
parentec12c2f051f94df6f4c86175caddc0d1108254cd (diff)
downloadcowboy-defce46fdf85d16bbe3c0a8de6058334e8a53775.tar.gz
cowboy-defce46fdf85d16bbe3c0a8de6058334e8a53775.tar.bz2
cowboy-defce46fdf85d16bbe3c0a8de6058334e8a53775.zip
REST: Allow generate_etag to return undefined
This allows conditionally generating an etag.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/manual/cowboy_rest.asciidoc9
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/src/manual/cowboy_rest.asciidoc b/doc/src/manual/cowboy_rest.asciidoc
index 0bb6d47..ea6dba9 100644
--- a/doc/src/manual/cowboy_rest.asciidoc
+++ b/doc/src/manual/cowboy_rest.asciidoc
@@ -379,7 +379,7 @@ and that the request shouldn't be repeated.
----
generate_etag(Req, State) -> {Result, Req, State}
-Result :: binary() | {weak | strong, binary()}
+Result :: binary() | {weak | strong, binary()} | undefined
Default - no etag value
----
@@ -389,6 +389,10 @@ When a binary is returned, the value is automatically
parsed to a tuple. The binary must be in the same
format as the etag header, including quotes.
+It is possible to conditionally generate an etag.
+When no etag can be generated, `undefined` should
+be returned.
+
=== is_authorized
[source,erlang]
@@ -730,6 +734,9 @@ listed here, like the authorization header.
== Changelog
+* *2.11*: The `generate_etag` callback can now return
+ `undefined` to conditionally avoid generating
+ an etag.
* *2.9*: An `AcceptCallback` can now return `{created, URI}` or
`{see_other, URI}`. The return value `{true, URI}`
is deprecated.