aboutsummaryrefslogtreecommitdiffstats
path: root/test/rest_handler_SUITE.erl
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 /test/rest_handler_SUITE.erl
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 'test/rest_handler_SUITE.erl')
-rw-r--r--test/rest_handler_SUITE.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/rest_handler_SUITE.erl b/test/rest_handler_SUITE.erl
index b082810..510098f 100644
--- a/test/rest_handler_SUITE.erl
+++ b/test/rest_handler_SUITE.erl
@@ -571,6 +571,17 @@ generate_etag_missing(Config) ->
false = lists:keyfind(<<"etag">>, 1, Headers),
ok.
+generate_etag_undefined(Config) ->
+ doc("The etag header must not be sent when "
+ "the generate_etag callback returns undefined."),
+ ConnPid = gun_open(Config),
+ Ref = gun:get(ConnPid, "/generate_etag?undefined", [
+ {<<"accept-encoding">>, <<"gzip">>}
+ ]),
+ {response, _, 200, Headers} = gun:await(ConnPid, Ref),
+ false = lists:keyfind(<<"etag">>, 1, Headers),
+ ok.
+
generate_etag_binary_strong(Config) ->
doc("The etag header must be sent when the generate_etag "
"callback returns a strong binary. (RFC7232 2.3)"),