Skip to content
  • Ryuta Kamizono's avatar
    b65bb377
    Fix `content_type=` to not discard extra part · b65bb377
    Ryuta Kamizono authored
    In #36996, the behavior of `content_type=` has been changed to treat a
    `content_type` itself as a mime type if a `content_type` doesn't contain
    `charset=...` part.
    
    i.e.
    
    ```ruby
    response.content_type = "text/html; fragment"
    response.media_type # => "text/html; fragment"
    
    response.content_type = "text/html; fragment; charset=utf-16"
    response.media_type # => "text/html"
    ```
    
    That is tricky and strange.
    
    I think that we cannot distinguish whether extra part is a part of mime
    type or not for now. So at least in Rails 6.0, we should not discard
    extra part conservatively as before.
    b65bb377
    Fix `content_type=` to not discard extra part
    Ryuta Kamizono authored
    In #36996, the behavior of `content_type=` has been changed to treat a
    `content_type` itself as a mime type if a `content_type` doesn't contain
    `charset=...` part.
    
    i.e.
    
    ```ruby
    response.content_type = "text/html; fragment"
    response.media_type # => "text/html; fragment"
    
    response.content_type = "text/html; fragment; charset=utf-16"
    response.media_type # => "text/html"
    ```
    
    That is tricky and strange.
    
    I think that we cannot distinguish whether extra part is a part of mime
    type or not for now. So at least in Rails 6.0, we should not discard
    extra part conservatively as before.
Loading