summaryrefslogtreecommitdiff
path: root/spec/bundler/support/artifice/helpers/endpoint_fallback.rb
blob: a232930b6785453dc0b2cb2c371bb8fe05ee9d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

require_relative "endpoint"

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