bundle-new/spec/support/artifice/endpoint_fallback.rb

18 lines
441 B
Ruby
Raw Permalink Normal View History

2019-10-06 15:45:34 +00:00
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
class EndpointFallback < Endpoint
DEPENDENCY_LIMIT = 60
get "/api/v1/dependencies" do
if params[:gems] && params[:gems].size <= DEPENDENCY_LIMIT
Marshal.dump(dependencies_for(params[:gems]))
else
halt 413, "Too many gems to resolve, please request less than #{DEPENDENCY_LIMIT} gems"
end
end
end
Artifice.activate_with(EndpointFallback)