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

require_relative "helpers/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

require_relative "helpers/artifice"

Artifice.activate_with(EndpointFallback)