0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Allow users to pass a raw binary() as the expires header.

This commit is contained in:
Drew Varner 2014-06-06 02:37:24 -04:00
parent 7a808e0aa3
commit 6ed25fd60b
4 changed files with 32 additions and 2 deletions

View file

@ -52,7 +52,7 @@
%% Cached resource calls.
etag :: undefined | no_call | {strong | weak, binary()},
last_modified :: undefined | no_call | calendar:datetime(),
expires :: undefined | no_call | calendar:datetime()
expires :: undefined | no_call | calendar:datetime() | binary()
}).
-spec upgrade(Req, Env, module(), any())
@ -896,6 +896,10 @@ set_resp_expires(Req, State) ->
case Expires of
Expires when is_atom(Expires) ->
{Req2, State2};
Expires when is_binary(Expires) ->
Req3 = cowboy_req:set_resp_header(
<<"expires">>, Expires, Req2),
{Req3, State2};
Expires ->
ExpiresBin = cowboy_clock:rfc1123(Expires),
Req3 = cowboy_req:set_resp_header(