mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
REST: Allow generate_etag to return undefined
This allows conditionally generating an etag.
This commit is contained in:
parent
ec12c2f051
commit
defce46fdf
4 changed files with 29 additions and 2 deletions
|
@ -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)"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue