refactor: drive cache freshness from pushed key maps

This commit is contained in:
Shivam Mishra
2026-06-10 13:16:04 +05:30
parent 4b2abcfbb2
commit d4dd5c64a7
22 changed files with 216 additions and 177 deletions
@@ -216,14 +216,15 @@ RSpec.describe 'Accounts API', type: :request do
expect(response.parsed_body['cache_keys'].keys).to match_array(%w[label inbox team])
end
it 'sets the appropriate cache headers' do
it 'does not allow cached cache key responses' do
get "/api/v1/accounts/#{account.id}/cache_keys",
headers: admin.create_new_auth_token,
as: :json
expect(response.headers['Cache-Control']).to include('max-age=10')
expect(response.headers['Cache-Control']).to include('max-age=0')
expect(response.headers['Cache-Control']).to include('private')
expect(response.headers['Cache-Control']).to include('stale-while-revalidate=300')
expect(response.headers['Cache-Control']).to include('must-revalidate')
expect(response.headers['Cache-Control']).not_to include('stale-while-revalidate')
end
end