Commit 3c62d869 authored by David Fernandez's avatar David Fernandez

Fix rails 6 Content-Type deprecation warning

DEPRECATION WARNING: Rails 6.1 will return Content-Type header without
modification. If you want just the MIME type, please use `#media_type`
instead.
parent ad751861
...@@ -482,7 +482,7 @@ describe API::ConanPackages do ...@@ -482,7 +482,7 @@ describe API::ConanPackages do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
end end
...@@ -498,7 +498,7 @@ describe API::ConanPackages do ...@@ -498,7 +498,7 @@ describe API::ConanPackages do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
end end
...@@ -513,7 +513,7 @@ describe API::ConanPackages do ...@@ -513,7 +513,7 @@ describe API::ConanPackages do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
it 'denies download when not enough permissions' do it 'denies download when not enough permissions' do
...@@ -688,7 +688,7 @@ describe API::ConanPackages do ...@@ -688,7 +688,7 @@ describe API::ConanPackages do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
it 'rejects request without a valid token' do it 'rejects request without a valid token' do
...@@ -725,7 +725,7 @@ describe API::ConanPackages do ...@@ -725,7 +725,7 @@ describe API::ConanPackages do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response).not_to have_key('TempPath') expect(json_response).not_to have_key('TempPath')
expect(json_response['RemoteObject']).to have_key('ID') expect(json_response['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL') expect(json_response['RemoteObject']).to have_key('GetURL')
...@@ -744,7 +744,7 @@ describe API::ConanPackages do ...@@ -744,7 +744,7 @@ describe API::ConanPackages do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(::Packages::PackageFileUploader.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(::Packages::PackageFileUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil expect(json_response['RemoteObject']).to be_nil
end end
......
...@@ -114,14 +114,14 @@ describe API::NpmPackages do ...@@ -114,14 +114,14 @@ describe API::NpmPackages do
get_file_with_token(package_file) get_file_with_token(package_file)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
it 'returns the file with a job token' do it 'returns the file with a job token' do
get_file_with_job_token(package_file) get_file_with_job_token(package_file)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
it 'denies download with no token' do it 'denies download with no token' do
...@@ -138,7 +138,7 @@ describe API::NpmPackages do ...@@ -138,7 +138,7 @@ describe API::NpmPackages do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
it_behaves_like 'a gitlab tracking event', described_class.name, 'pull_package' it_behaves_like 'a gitlab tracking event', described_class.name, 'pull_package'
...@@ -514,7 +514,7 @@ describe API::NpmPackages do ...@@ -514,7 +514,7 @@ describe API::NpmPackages do
def expect_a_valid_package_response def expect_a_valid_package_response
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(response).to match_response_schema('public_api/v4/packages/npm_package', dir: 'ee') expect(response).to match_response_schema('public_api/v4/packages/npm_package', dir: 'ee')
expect(json_response['name']).to eq(package.name) expect(json_response['name']).to eq(package.name)
expect(json_response['versions'][package.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee') expect(json_response['versions'][package.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee')
......
...@@ -10,7 +10,7 @@ describe 'Git HTTP requests' do ...@@ -10,7 +10,7 @@ describe 'Git HTTP requests' do
it do it do
download(path, env) do |response| download(path, env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
end end
...@@ -19,7 +19,7 @@ describe 'Git HTTP requests' do ...@@ -19,7 +19,7 @@ describe 'Git HTTP requests' do
it do it do
upload(path, env) do |response| upload(path, env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
end end
......
...@@ -49,7 +49,7 @@ RSpec.shared_examples 'process nuget service index request' do |user_type, statu ...@@ -49,7 +49,7 @@ RSpec.shared_examples 'process nuget service index request' do |user_type, statu
it 'returns a valid json response' do it 'returns a valid json response' do
subject subject
expect(response.content_type.to_s).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema('public_api/v4/packages/nuget/service_index', dir: 'ee') expect(json_response).to match_schema('public_api/v4/packages/nuget/service_index', dir: 'ee')
expect(json_response).to be_a(Hash) expect(json_response).to be_a(Hash)
end end
...@@ -66,7 +66,7 @@ RSpec.shared_examples 'returning nuget metadata json response with json schema' ...@@ -66,7 +66,7 @@ RSpec.shared_examples 'returning nuget metadata json response with json schema'
it 'returns a valid json response' do it 'returns a valid json response' do
subject subject
expect(response.content_type.to_s).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema(json_schema, dir: 'ee') expect(json_response).to match_schema(json_schema, dir: 'ee')
expect(json_response).to be_a(Hash) expect(json_response).to be_a(Hash)
end end
...@@ -135,7 +135,7 @@ RSpec.shared_examples 'process nuget workhorse authorization' do |user_type, sta ...@@ -135,7 +135,7 @@ RSpec.shared_examples 'process nuget workhorse authorization' do |user_type, sta
it 'has the proper content type' do it 'has the proper content type' do
subject subject
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
context 'with a request that bypassed gitlab-workhorse' do context 'with a request that bypassed gitlab-workhorse' do
...@@ -227,7 +227,7 @@ RSpec.shared_examples 'process nuget download versions request' do |user_type, s ...@@ -227,7 +227,7 @@ RSpec.shared_examples 'process nuget download versions request' do |user_type, s
it 'returns a valid json response' do it 'returns a valid json response' do
subject subject
expect(response.content_type.to_s).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema('public_api/v4/packages/nuget/download_versions', dir: 'ee') expect(json_response).to match_schema('public_api/v4/packages/nuget/download_versions', dir: 'ee')
expect(json_response).to be_a(Hash) expect(json_response).to be_a(Hash)
expect(json_response['versions']).to match_array(packages.map(&:version).sort) expect(json_response['versions']).to match_array(packages.map(&:version).sort)
...@@ -270,7 +270,7 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st ...@@ -270,7 +270,7 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
it 'returns a valid package archive' do it 'returns a valid package archive' do
subject subject
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
context 'with invalid format' do context 'with invalid format' do
...@@ -287,7 +287,7 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st ...@@ -287,7 +287,7 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
it 'returns a valid package archive' do it 'returns a valid package archive' do
subject subject
expect(response.content_type.to_s).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
end end
end end
......
...@@ -22,7 +22,7 @@ RSpec.shared_examples 'returns package tags' do |user_type| ...@@ -22,7 +22,7 @@ RSpec.shared_examples 'returns package tags' do |user_type|
it 'returns a valid json response' do it 'returns a valid json response' do
subject subject
expect(response.content_type.to_s).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(json_response).to be_a(Hash) expect(json_response).to be_a(Hash)
end end
......
...@@ -1462,7 +1462,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -1462,7 +1462,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(JobArtifactUploader.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(JobArtifactUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil expect(json_response['RemoteObject']).to be_nil
end end
...@@ -1482,7 +1482,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -1482,7 +1482,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response).not_to have_key('TempPath') expect(json_response).not_to have_key('TempPath')
expect(json_response['RemoteObject']).to have_key('ID') expect(json_response['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL') expect(json_response['RemoteObject']).to have_key('GetURL')
...@@ -1558,7 +1558,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -1558,7 +1558,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
authorize_artifacts_with_token_in_headers authorize_artifacts_with_token_in_headers
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).not_to be_nil expect(json_response['TempPath']).not_to be_nil
end end
......
...@@ -92,7 +92,7 @@ describe 'Git HTTP requests' do ...@@ -92,7 +92,7 @@ describe 'Git HTTP requests' do
it 'allows pulls' do it 'allows pulls' do
download(path, env) do |response| download(path, env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
end end
...@@ -101,7 +101,7 @@ describe 'Git HTTP requests' do ...@@ -101,7 +101,7 @@ describe 'Git HTTP requests' do
it 'allows pushes', :sidekiq_might_not_need_inline do it 'allows pushes', :sidekiq_might_not_need_inline do
upload(path, env) do |response| upload(path, env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
end end
...@@ -509,7 +509,7 @@ describe 'Git HTTP requests' do ...@@ -509,7 +509,7 @@ describe 'Git HTTP requests' do
download(path, env) do download(path, env) do
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
...@@ -518,7 +518,7 @@ describe 'Git HTTP requests' do ...@@ -518,7 +518,7 @@ describe 'Git HTTP requests' do
upload(path, env) do upload(path, env) do
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
......
...@@ -907,7 +907,7 @@ describe 'Git LFS API and storage' do ...@@ -907,7 +907,7 @@ describe 'Git LFS API and storage' do
it_behaves_like 'LFS http 200 response' it_behaves_like 'LFS http 200 response'
it 'uses the gitlab-workhorse content type' do it 'uses the gitlab-workhorse content type' do
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment