Commit 81e2dd75 authored by Steve Abrams's avatar Steve Abrams

Use read method to get request body in Conan

The method 'string' does not exist for Unicorn::TeeInput
causing Conan upload_urls endpoints to fail when reading
request.body.string.
parent a729fbbe
---
title: Use 'read' method to get request body in Conan to fix uploads when using Unicorn
merge_request: 41801
author:
type: fixed
......@@ -140,7 +140,7 @@ module API
end
def file_names
json_payload = Gitlab::Json.parse(request.body.string)
json_payload = Gitlab::Json.parse(request.body.read)
bad_request!(nil) unless json_payload.is_a?(Hash)
......
......@@ -383,6 +383,16 @@ RSpec.describe API::ConanPackages do
end
end
shared_examples 'successful response when using Unicorn' do
context 'on Unicorn', :unicorn do
it 'returns successfully' do
subject
expect(response).to have_gitlab_http_status(:ok)
end
end
end
describe 'GET /api/v4/packages/conan/v1/conans/:package_name/package_version/:package_username/:package_channel' do
let(:recipe_path) { package.conan_recipe_path }
......@@ -478,6 +488,7 @@ RSpec.describe API::ConanPackages do
it_behaves_like 'rejects invalid recipe'
it_behaves_like 'rejects invalid upload_url params'
it_behaves_like 'successful response when using Unicorn'
it 'returns a set of upload urls for the files requested' do
subject
......@@ -541,6 +552,7 @@ RSpec.describe API::ConanPackages do
it_behaves_like 'rejects invalid recipe'
it_behaves_like 'rejects invalid upload_url params'
it_behaves_like 'successful response when using Unicorn'
it 'returns a set of upload urls for the files requested' do
expected_response = {
......
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