Follow the specification to use the JSON api, the content type must be set to
application/vnd.api+json
ContentType
def foo
response.headers['Content-Type'] = 'application/vnd.api+json'
# ...
end
You can use the before_action
directive:
class ApplicationController < ActionController::API
before_action :set_headers
def set_headers
response.headers['Content-Type'] = 'application/vnd.api+json'
end
end