Accept JSON requests more liberally in API

This commit is contained in:
Thibault Jouan 2015-05-03 20:15:48 +00:00
parent eb62ab96ff
commit db7de0c038

View File

@ -37,8 +37,11 @@ module API
end
def json_filter!
return if request.format.json?
head :not_acceptable, content_type: 'application/json'
if request.format.json? || request.accepts.include?(:json)
request.format = :json
else
head :not_acceptable, content_type: 'application/json'
end
end
end
end