Class: Berkshelf::API::Endpoint::Base
- Inherits:
-
Grape::API
- Object
- Grape::API
- Berkshelf::API::Endpoint::Base
- Defined in:
- lib/berkshelf/api/endpoint.rb
Instance Method Summary collapse
-
#call(env) ⇒ Object
Force inbound requests to be JSON.
Instance Method Details
#call(env) ⇒ Object
Force inbound requests to be JSON
8 9 10 11 12 13 |
# 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 |