Fail fast if response is empty
This commit is contained in:
parent
c47a222c83
commit
05eaee6d11
@ -8,6 +8,8 @@ class CPIFeed < Sinatra::Base
|
||||
get '/' do
|
||||
resp = JSON.parse(Faraday.get(cpi_series_url).body)
|
||||
|
||||
halt 502 unless resp['Results']['series']
|
||||
|
||||
expires 300, :public, :must_revalidate
|
||||
content_type :csv
|
||||
"cpi\n#{resp['Results']['series'].first['data'].first['value']}\n"
|
||||
|
Loading…
Reference in New Issue
Block a user