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

Use media_type instead of content_type #313

Merged
merged 1 commit into from
Aug 6, 2019
Merged

Use media_type instead of content_type #313

merged 1 commit into from
Aug 6, 2019

Conversation

eugeneius
Copy link
Contributor

Fixes #312.

Rails 6.0.0.rc2 changed the behaviour of the content_type method to include the charset media type parameter. This broke our content type check, which assumed no parameters would be present. A new media_type method was also added that returns the media type without parameters.

We can fix the content type check on Rails 6.0 while staying compatible with older Rails versions by using the media_type method if it exists, and falling back to the content_type method otherwise.

Rails 6.0.0.rc2 changed the behaviour of the `content_type` method to
include the `charset` media type parameter. This broke our content type
check, which assumed no parameters would be present. A new `media_type`
method was also added that returns the media type without parameters.

We can fix the content type check on Rails 6.0 while staying compatible
with older Rails versions by using the `media_type` method if it exists,
and falling back to the `content_type` method otherwise.
@eugeneius eugeneius merged commit bbcb58b into master Aug 6, 2019
@jonnyom jonnyom deleted the elk/media_type branch August 6, 2019 15:30
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.

Messenger is not visible in Rails 6.0rc2
2 participants