Always set Content-Type to JSON

Fixes #45
This commit is contained in:
Hakan Ensari 2017-01-07 00:57:01 +00:00
parent 2b85a05380
commit 3fdae1090b
2 changed files with 11 additions and 0 deletions

View File

@ -65,6 +65,10 @@ options '*' do
200 200
end end
before do
content_type 'application/json'
end
get '/' do get '/' do
last_modified App.released_at last_modified App.released_at
jsonp details: 'http://fixer.io', version: App.version jsonp details: 'http://fixer.io', version: App.version

View File

@ -96,4 +96,11 @@ describe 'the API' do
get '/latest' get '/latest'
last_response.body.must_equal 'foo' last_response.body.must_equal 'foo'
end end
it 'sets Content-Type header to JSON when caching' do
2.times do
get '/latest'
last_response.headers['Content-Type'].must_equal 'application/json'
end
end
end end