Add cache-control header to response

This commit is contained in:
Hakan Ensari 2023-03-01 14:28:18 +00:00
parent 9c974df575
commit 6e09acc767
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,8 @@ module Web
plugin :params_capturing plugin :params_capturing
route do |r| route do |r|
response.cache_control public: true, max_age: 900
r.root do r.root do
{ docs: 'https://www.frankfurter.app/docs' } { docs: 'https://www.frankfurter.app/docs' }
end end

View File

@ -56,6 +56,13 @@ describe 'the server' do
end end
end end
it 'returns a cache control header' do
%w[/latest /2012-11-20].each do |path|
get path
_(headers['Cache-Control']).wont_be_nil
end
end
it 'allows cross-origin requests' do it 'allows cross-origin requests' do
%w[/ /latest /2012-11-20].each do |path| %w[/ /latest /2012-11-20].each do |path|
header 'Origin', '*' header 'Origin', '*'