mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 02:52:49 +01:00
Add Last Modified header
This commit is contained in:
parent
c1f2ed25e7
commit
5094956f7c
@ -53,11 +53,14 @@ get '/' do
|
||||
end
|
||||
|
||||
get '/latest' do
|
||||
last_modified quote[:date]
|
||||
jsonp quote
|
||||
end
|
||||
|
||||
get(/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/) do
|
||||
transform_date
|
||||
last_modified quote[:date]
|
||||
|
||||
jsonp quote
|
||||
end
|
||||
|
||||
|
@ -40,6 +40,16 @@ describe 'the API' do
|
||||
json['rates'].wont_be :empty?
|
||||
end
|
||||
|
||||
it 'returns a last modified header for latest quote' do
|
||||
get '/latest'
|
||||
headers['Last-Modified'].wont_be_nil
|
||||
end
|
||||
|
||||
it 'returns a last modified header for historical quote' do
|
||||
get '/2012-11-20'
|
||||
headers['Last-Modified'].wont_be_nil
|
||||
end
|
||||
|
||||
it 'allows cross-origin requests' do
|
||||
get '/', {}, 'HTTP_ORIGIN' => 'http://localhost'
|
||||
assert_equal 'http://localhost', headers['Access-Control-Allow-Origin']
|
||||
|
Loading…
Reference in New Issue
Block a user