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
|
@ -34,6 +34,9 @@ generate_etag(Req=#{qs := <<"binary-weak-unquoted">>}, State) ->
|
|||
generate_etag(Req=#{qs := <<"binary-strong-unquoted">>}, State) ->
|
||||
ct_helper_error_h:ignore(cow_http_hd, parse_etag, 1),
|
||||
{<<"etag-header-value">>, Req, State};
|
||||
%% Returning 'undefined' to indicate no etag.
|
||||
generate_etag(Req=#{qs := <<"undefined">>}, State) ->
|
||||
{undefined, Req, State};
|
||||
%% Simulate the callback being missing in other cases.
|
||||
generate_etag(#{qs := <<"missing">>}, _) ->
|
||||
no_call.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue