lib/litmus_paper/app.rb in litmus_paper-0.3.2 vs lib/litmus_paper/app.rb in litmus_paper-0.3.3
- old
+ new
@@ -26,14 +26,13 @@
text 404, "NOT FOUND"
end
end
get "/:service/status" do
- service = LitmusPaper.services[params[:service]]
- if service.nil?
+ health = LitmusPaper.check_service(params[:service])
+ if health.nil?
text 404, "NOT FOUND", { "X-Health" => "0" }
else
- health = service.current_health
response_code = health.ok? ? 200 : 503
body = "Health: #{health.value}\n"
body << health.summary
text response_code, body, { "X-Health" => health.value.to_s }
end