22 lines
485 B
Ruby
22 lines
485 B
Ruby
module Gitlab
|
|
module Middleware
|
|
class ReadOnly
|
|
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE).freeze
|
|
APPLICATION_JSON = 'application/json'.freeze
|
|
API_VERSIONS = (3..4)
|
|
|
|
def self.internal_routes
|
|
@internal_routes ||=
|
|
API_VERSIONS.map { |version| "api/v#{version}/internal" }
|
|
end
|
|
|
|
def initialize(app)
|
|
@app = app
|
|
end
|
|
|
|
def call(env)
|
|
ReadOnly::Controller.new(@app, env).call
|
|
end
|
|
end
|
|
end
|
|
end
|