Root returns link to docs

This commit is contained in:
Hakan Ensari 2020-05-02 19:38:36 +01:00
parent 1116343424
commit 7e2c69132d
3 changed files with 14 additions and 5 deletions

View File

@ -4,10 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Changed
- Root returns link to docs
- Handle rounding edge case where a lower-rate base currency like IDR produces less precise quotes
- Sample weekly when querying over a year
- Bump PostgreSQL to 12
### Fixed
- Set charset to UTF-8
## 1.0.0 - 2020-01-02
### Fixed
- Start versioning images so users can track changes

View File

@ -57,17 +57,17 @@ helpers do
callback = params['callback']
if callback
content_type :js
content_type :js, charset: Encoding::UTF_8
"#{callback}(#{json})"
else
content_type :json
content_type :json, charset: Encoding::UTF_8
json
end
end
end
get '/' do
redirect 'https://www.frankfurter.app', 301
json({ docs: 'https://wwww.frankfurter.app/docs' })
end
get '/(?:latest|current)', mustermann_opts: { type: :regexp } do

View File

@ -11,9 +11,9 @@ describe 'the server' do
let(:json) { Oj.load(last_response.body) }
let(:headers) { last_response.headers }
it 'redirects root to documentation site' do
it 'returns link to docs' do
get '/'
_(last_response).must_be :redirect?
_(json['docs']).wont_be_nil
end
it 'returns latest quotes' do
@ -102,4 +102,9 @@ describe 'the server' do
get '/latest?callback=foo'
_(last_response.body).must_be :start_with?, 'foo'
end
it 'sets charset to UTF-8' do
get '/currencies'
_(last_response.headers['content-type']).must_be :end_with?, 'charset=UTF-8'
end
end