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:
parent
8427f0eb75
commit
65809f8ea0
3 changed files with 4 additions and 4 deletions
|
@ -17,7 +17,7 @@ Rails.application.config.action_view.default_enforce_utf8 = false
|
||||||
Rails.application.config.action_dispatch.use_cookies_with_metadata = true
|
Rails.application.config.action_dispatch.use_cookies_with_metadata = true
|
||||||
|
|
||||||
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
|
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
|
||||||
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
|
Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
|
||||||
|
|
||||||
# Return false instead of self when enqueuing is aborted from a callback.
|
# Return false instead of self when enqueuing is aborted from a callback.
|
||||||
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
|
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
|
||||||
|
|
|
@ -540,8 +540,8 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
format: :js
|
format: :js
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responses in the correct format" do
|
it 'responds in the correct format' do
|
||||||
expect(response.content_type).to eq "text/javascript"
|
expect(response.media_type).to eq('text/javascript')
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe NewAdministrateur::AttestationTemplatesController, type: :controller do
|
||||||
render_views
|
render_views
|
||||||
it 'renders a PDF' do
|
it 'renders a PDF' do
|
||||||
expect(subject.status).to eq(200)
|
expect(subject.status).to eq(200)
|
||||||
expect(subject.content_type).to eq('application/pdf')
|
expect(subject.media_type).to eq('application/pdf')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue