aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/handlers/last_modified_h.erl2
-rw-r--r--test/rest_handler_SUITE.erl10
2 files changed, 12 insertions, 0 deletions
diff --git a/test/handlers/last_modified_h.erl b/test/handlers/last_modified_h.erl
index 82893b3..1b109e3 100644
--- a/test/handlers/last_modified_h.erl
+++ b/test/handlers/last_modified_h.erl
@@ -19,6 +19,8 @@ get_text_plain(Req, State) ->
last_modified(Req=#{qs := <<"tuple">>}, State) ->
{{{2012, 9, 21}, {22, 36, 14}}, Req, State};
+last_modified(Req=#{qs := <<"undefined">>}, State) ->
+ {undefined, Req, State};
%% Simulate the callback being missing in other cases.
last_modified(#{qs := <<"missing">>}, _) ->
no_call.
diff --git a/test/rest_handler_SUITE.erl b/test/rest_handler_SUITE.erl
index a3d9533..7a9566f 100644
--- a/test/rest_handler_SUITE.erl
+++ b/test/rest_handler_SUITE.erl
@@ -796,6 +796,16 @@ last_modified_missing(Config) ->
false = lists:keyfind(<<"last-modified">>, 1, Headers),
ok.
+last_modified_undefined(Config) ->
+ doc("The last-modified header must not be sent when the callback returns undefined."),
+ ConnPid = gun_open(Config),
+ Ref = gun:get(ConnPid, "/last_modified?undefined", [
+ {<<"accept-encoding">>, <<"gzip">>}
+ ]),
+ {response, _, 200, Headers} = gun:await(ConnPid, Ref),
+ false = lists:keyfind(<<"last-modified">>, 1, Headers),
+ ok.
+
options_missing(Config) ->
doc("A successful OPTIONS request to a simple handler results in "
"a 200 OK response with the allow header set. (RFC7231 4.3.7)"),