Added retrying
This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
require 'json'
|
||||
require 'sinatra/base'
|
||||
require 'sinatra/custom_logger'
|
||||
require_relative '../http/query'
|
||||
require_relative '../exceptions'
|
||||
|
||||
module Pruning
|
||||
module API
|
||||
class App < Sinatra::Base
|
||||
before { content_type :json }
|
||||
after { serialise_response }
|
||||
set :show_exceptions, true
|
||||
|
||||
|
||||
error Pruning::Exceptions::UnexpectedError do
|
||||
status 500
|
||||
end
|
||||
|
||||
error Pruning::Exceptions::OriginCannotFindTheResource do
|
||||
status 404
|
||||
end
|
||||
|
||||
|
||||
get '/' do
|
||||
"Try /tree/:name"
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def serialise_response
|
||||
return unless content_type == 'application/json'
|
||||
response.body = [JSON(response.body)]
|
||||
|
||||
Reference in New Issue
Block a user