class Berkshelf::API::Endpoint::Base

Public Instance Methods

call(env) click to toggle source

Force inbound requests to be JSON

Calls superclass method
# File lib/berkshelf/api/endpoint.rb, line 8
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