/usr/lib/ruby/vendor_ruby/berkshelf/api/endpoint.rb is in berkshelf-api 2.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | require 'grape'
require 'grape-msgpack'
module Berkshelf::API
module Endpoint
class Base < Grape::API
# Force inbound requests to be JSON
def call(env)
env['CONTENT_TYPE'] = 'application/json'
# If coming from a browser or other naive HTTP client, we want JSON back
env['HTTP_ACCEPT'] = 'application/json' if !env['HTTP_ACCEPT'] || env['HTTP_ACCEPT'].include?('text/html')
super
end
end
end
end
Dir["#{File.dirname(__FILE__)}/endpoint/*.rb"].sort.each do |path|
require "berkshelf/api/endpoint/#{File.basename(path, '.rb')}"
end
|