config: flip action_dispatch_return_only_media_type_on_content_type

This makes `ActionDispatch::Controller#content_type` return not only
the MIME type, but also in some circumstances the charset.

Example:

```ruby
reponse.content_type == 'text/html; charset=utf-8'
```

The MIME type-only fragment can now be accessed using `#media_type`.

Changes to the tests are not stricly necessary (because no charset is
present in the actual value), but represent the intent better.
This commit is contained in:
Pierre de La Morinerie 2020-07-13 17:36:28 +02:00
parent 8427f0eb75
commit 65809f8ea0
3 changed files with 4 additions and 4 deletions

View file

@ -540,8 +540,8 @@ describe Instructeurs::ProceduresController, type: :controller do
format: :js
end
it "responses in the correct format" do
expect(response.content_type).to eq "text/javascript"
it 'responds in the correct format' do
expect(response.media_type).to eq('text/javascript')
expect(response).to have_http_status(:ok)
end
end

View file

@ -23,7 +23,7 @@ describe NewAdministrateur::AttestationTemplatesController, type: :controller do
render_views
it 'renders a PDF' do
expect(subject.status).to eq(200)
expect(subject.content_type).to eq('application/pdf')
expect(subject.media_type).to eq('application/pdf')
end
end