Permalink
Browse files

Including both Cache-Control and Expires headers apparently isn't red…

…undant.

This reverts commit 6055f0d.
  • Loading branch information...
1 parent 659884d commit e024fa62cd11985bcff34eebacdbcc0d89b4311d @magnars committed Dec 28, 2013
@@ -22,6 +22,7 @@
(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,7 +22,8 @@
{:path "/f549e6e556ea/code.js"
:original-path "/code.js"
:contents "1 + 2"
- :headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}])
+ :headers {"Cache-Control" "max-age=315360000"
+ "Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}])
(fact
"While it's important that the :original-path property is set, so
@@ -45,6 +46,7 @@
(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,7 +6,8 @@
(:use midje.sweet))
(with-redefs [time/now (fn [] (time/date-time 2013 07 30))]
- (def headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"})
+ (def headers {"Cache-Control" "max-age=315360000"
+ "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 {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}])
+ [{:path "/more.js" :contents "3 + 4" :headers {"Cache-Control" "max-age=315360000"}}])
(let [app (serve-live-assets noop get-assets dont-optimize {})]
- (app {:uri "/more.js"}) => {:status 200 :body "3 + 4" :headers {"Expires" "Fri, 28 Jul 2023 00:00:00 GMT"}}))
+ (app {:uri "/more.js"}) => {:status 200 :body "3 + 4" :headers {"Cache-Control" "max-age=315360000"}}))
(fact
"Assets are fetched for each request. We wouldn't want to restart the

0 comments on commit e024fa6

Please sign in to comment.