Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't clobber the JSON MIME type. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meadmaker
Copy link
Contributor

simple_datatables was preventing Rails from parsing POST messages with a JSON body. The reason was that Mime::Type.register will associate a symbol with a mime type for both content generation (outbound HTTP responses, for instance) and content parsing (inbound HTTP requests), so when the middleware retrieved the identifying symbol associated with the application/json datatype, it got back :datatables, which it ignored. Mime::Type.register_alias will associate the symbol with the mime type for content generation only, so parsing the JSON body into a parameters array still works.

simple_datatables was preventing Rails from parsing POST messages with a JSON
body.  The reason was that Mime::Type.register will associate a symbol with a
mime type for both content generation (outbound HTTP responses, for instance)
and content parsing (inbound HTTP requests), so when the middleware retrieved
the identifying symbol associated with the application/json datatype, it got
back :datatables, which it ignored. Mime::Type.register_alias will associate
the symbol with the mime type for content generation only, so parsing the JSON
body into a parameters array still works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant