Skip to content

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