Set 'Expires' header to 0 for all responses
This commit is contained in:
@@ -46,6 +46,7 @@ class LiquorCabinet < Sinatra::Base
|
|||||||
'Access-Control-Expose-Headers' => 'ETag'
|
'Access-Control-Expose-Headers' => 'ETag'
|
||||||
headers['Access-Control-Allow-Origin'] = env["HTTP_ORIGIN"] if env["HTTP_ORIGIN"]
|
headers['Access-Control-Allow-Origin'] = env["HTTP_ORIGIN"] if env["HTTP_ORIGIN"]
|
||||||
headers['Cache-Control'] = 'no-cache'
|
headers['Cache-Control'] = 'no-cache'
|
||||||
|
headers['Expires'] = 0
|
||||||
|
|
||||||
@user, @key = params[:user], params[:key]
|
@user, @key = params[:user], params[:key]
|
||||||
@directory = params[:splat] && params[:splat].first || ""
|
@directory = params[:splat] && params[:splat].first || ""
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ describe "Directories" do
|
|||||||
last_response.headers["Access-Control-Expose-Headers"].must_equal "ETag"
|
last_response.headers["Access-Control-Expose-Headers"].must_equal "ETag"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "has caching headers set" do
|
||||||
|
get "/jimmy/tasks/"
|
||||||
|
|
||||||
|
last_response.status.must_equal 200
|
||||||
|
last_response.headers["Expires"].must_equal 0
|
||||||
|
end
|
||||||
|
|
||||||
context "when If-None-Match header is set" do
|
context "when If-None-Match header is set" do
|
||||||
before do
|
before do
|
||||||
get "/jimmy/tasks/"
|
get "/jimmy/tasks/"
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ describe "App with Riak backend" do
|
|||||||
last_response.status.must_equal 200
|
last_response.status.must_equal 200
|
||||||
last_response.headers["ETag"].wont_be_nil
|
last_response.headers["ETag"].wont_be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "has caching headers set" do
|
||||||
|
last_response.status.must_equal 200
|
||||||
|
last_response.headers["Expires"].must_equal 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET data with custom content type" do
|
describe "GET data with custom content type" do
|
||||||
|
|||||||
Reference in New Issue
Block a user