intercom / intercom-rails

The easiest way to install Intercom in a Rails app.
https://developers.intercom.io/reference
MIT License
281 stars 107 forks source link

Use media_type instead of content_type #313

Closed eugeneius closed 5 years ago

eugeneius commented 5 years ago

Fixes https://github.com/intercom/intercom-rails/issues/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.