Permalink
Browse files

Including both Cache-Control and Expires headers is redundant.

- Use Expires since it's more widely supported.
  • Loading branch information...
1 parent b46a2e6 commit 6055f0d620f67d637682ce744cd666a1d402fc82 @magnars committed Dec 13, 2013
@@ -22,7 +22,6 @@
(subs (digest/sha-1 (get-contents file)) 0 12)
(:path file)))
(assoc :original-path (original-path file))
- (assoc-in [:headers "Cache-Control"] "max-age=315360000")
(assoc-in [:headers "Expires"] (http-date-formatter (time/plus (time/now)
(time/days 3650))))))
@@ -22,8 +22,7 @@
{:path "/f549e6e556ea/code.js"
:original-path "/code.js"
:contents "1 + 2"
- :headers {"Cache-Control" "max-age=315360000"
- "Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}])
+ :headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}])
(fact
"While it's important that the :original-path property is set, so
@@ -46,7 +45,6 @@
(map (juxt :path :headers)))
=> [["/c.js" {"Last-Modified" "Fri, 28 Jul 2023 00:00:00 GMT"}]
["/f549e6e556ea/c.js" {"Last-Modified" "Fri, 28 Jul 2023 00:00:00 GMT"
- "Cache-Control" "max-age=315360000"
"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}]])
(fact
@@ -6,8 +6,7 @@
(:use midje.sweet))
(with-redefs [time/now (fn [] (time/date-time 2013 07 30))]
- (def headers {"Cache-Control" "max-age=315360000"
- "Expires" "Fri, 28 Jul 2023 00:00:00 GMT"})
+ (def headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"})
(fact
"This is a big integration test, for sure. It bundles bundles, it
@@ -22,10 +22,10 @@
"Headers are included."
(defn get-assets []
- [{:path "/more.js" :contents "3 + 4" :headers {"Cache-Control" "max-age=315360000"}}])
+ [{:path "/more.js" :contents "3 + 4" :headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}])
(let [app (serve-live-assets noop get-assets dont-optimize {})]
- (app {:uri "/more.js"}) => {:status 200 :body "3 + 4" :headers {"Cache-Control" "max-age=315360000"}}))
+ (app {:uri "/more.js"}) => {:status 200 :body "3 + 4" :headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}))
(fact
"Assets are fetched for each request. We wouldn't want to restart the

0 comments on commit 6055f0d

Please sign in to comment.