move 'content_type :json' to the beginning of endpoint defs

This commit is contained in:
Scott Schneider 2015-02-25 17:24:28 -08:00
parent 0678767e6b
commit f73ac7a38c

View file

@ -49,6 +49,8 @@ module Vmpooler
end end
get '/dashboard/stats/vmpooler/pool/?' do get '/dashboard/stats/vmpooler/pool/?' do
content_type :json
result = Hash.new result = Hash.new
$config[:pools].each do |pool| $config[:pools].each do |pool|
@ -98,11 +100,12 @@ module Vmpooler
end end
end end
content_type :json
JSON.pretty_generate(result) JSON.pretty_generate(result)
end end
get '/dashboard/stats/vmpooler/running/?' do get '/dashboard/stats/vmpooler/running/?' do
content_type :json
result = Hash.new result = Hash.new
$config[:pools].each do |pool| $config[:pools].each do |pool|
@ -149,7 +152,6 @@ module Vmpooler
end end
end end
content_type :json
JSON.pretty_generate(result) JSON.pretty_generate(result)
end end
@ -230,6 +232,8 @@ module Vmpooler
end end
get '/summary/?' do get '/summary/?' do
content_type :json
result = { result = {
clone: { clone: {
duration: { duration: {
@ -341,7 +345,6 @@ module Vmpooler
result[:clone][:count][:average] = mean(total_clones_per_day) result[:clone][:count][:average] = mean(total_clones_per_day)
end end
content_type :json
JSON.pretty_generate(result) JSON.pretty_generate(result)
end end