According to the Grape documentation, this endpoint should only accept JSON requests, and all other formats should result in a 406 response code.
The following API will only respond to the JSON content-type and will not parse any other input than application/json, application/x-www-form-urlencoded, multipart/form-data, multipart/related and multipart/mixed. All other requests will fail with an HTTP 406 error code.
class Twitter::API < Grape::API
format :json
default_format :json
end
I am finding that posting text/plain in JSON format does not result in a 406. Debugging within the endpoint shows that env['CONTENT_TYPE'] is indeed text/plain.
According to the Grape documentation, this endpoint should only accept JSON requests, and all other formats should result in a
406response code.I am finding that posting
text/plainin JSON format does not result in a 406. Debugging within the endpoint shows thatenv['CONTENT_TYPE']is indeedtext/plain.