feat: remove http caching from cache keys

This commit is contained in:
Shivam Mishra
2026-06-08 19:01:24 +05:30
parent 91f2df8834
commit b8629e5aa8
2 changed files with 4 additions and 4 deletions
@@ -50,7 +50,6 @@ class Api::V1::AccountsController < Api::BaseController
end
def cache_keys
expires_in 10.seconds, public: false, stale_while_revalidate: 5.minutes
render json: { cache_keys: cache_keys_for_account }, status: :ok
end
@@ -216,14 +216,15 @@ RSpec.describe 'Accounts API', type: :request do
expect(response.parsed_body['cache_keys'].keys).to match_array(%w[account_user canned_response custom_attribute_definition inbox label 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