Commit fed7955f authored by Ash McKenzie's avatar Ash McKenzie Committed by Douglas Barbosa Alexandre

The info/refs request does not need headers

parent fa2edec2
...@@ -54,9 +54,8 @@ module Gitlab ...@@ -54,9 +54,8 @@ module Gitlab
ensure_secondary! ensure_secondary!
url = "#{primary_repo}/info/refs?service=git-receive-pack" url = "#{primary_repo}/info/refs?service=git-receive-pack"
headers = { 'Content-Type' => RECEIVE_PACK_REQUEST_CONTENT_TYPE }
resp = get(url, headers) resp = get(url)
resp.body = remove_receive_pack_http_service_fragment_from(resp.body) if resp.is_a?(Net::HTTPSuccess) resp.body = remove_receive_pack_http_service_fragment_from(resp.body) if resp.is_a?(Net::HTTPSuccess)
APIResponse.from_http_response(resp, primary_repo) APIResponse.from_http_response(resp, primary_repo)
...@@ -110,7 +109,7 @@ module Gitlab ...@@ -110,7 +109,7 @@ module Gitlab
URI.parse(primary_repo).path.gsub(%r{^\/|\.git$}, '') URI.parse(primary_repo).path.gsub(%r{^\/|\.git$}, '')
end end
def get(url, headers) def get(url, headers = {})
request(url, Net::HTTP::Get, headers) request(url, Net::HTTP::Get, headers)
end end
......
...@@ -62,7 +62,6 @@ describe Gitlab::Geo::GitSSHProxy, :geo do ...@@ -62,7 +62,6 @@ describe Gitlab::Geo::GitSSHProxy, :geo do
let(:current_node) { secondary_node } let(:current_node) { secondary_node }
let(:full_info_refs_url) { "#{primary_repo_http}/info/refs?service=git-receive-pack" } let(:full_info_refs_url) { "#{primary_repo_http}/info/refs?service=git-receive-pack" }
let(:info_refs_receive_pack_headers) { base_headers.merge('Content-Type' => 'application/x-git-upload-pack-request') }
let(:info_refs_http_body_full) { "001f# service=git-receive-pack\n0000#{info_refs_body_short}" } let(:info_refs_http_body_full) { "001f# service=git-receive-pack\n0000#{info_refs_body_short}" }
context 'authorization header is scoped' do context 'authorization header is scoped' do
...@@ -111,7 +110,7 @@ describe Gitlab::Geo::GitSSHProxy, :geo do ...@@ -111,7 +110,7 @@ describe Gitlab::Geo::GitSSHProxy, :geo do
let(:error_msg) { 'dial unix /Users/ash/src/gdk/gdk-ee/gitlab.socket: connect: connection refused' } let(:error_msg) { 'dial unix /Users/ash/src/gdk/gdk-ee/gitlab.socket: connect: connection refused' }
before do before do
stub_request(:get, full_info_refs_url).to_return(status: 502, body: error_msg, headers: info_refs_receive_pack_headers) stub_request(:get, full_info_refs_url).to_return(status: 502, body: error_msg)
end end
it 'returns a Gitlab::Geo::GitSSHProxy::FailedAPIResponse' do it 'returns a Gitlab::Geo::GitSSHProxy::FailedAPIResponse' do
...@@ -137,7 +136,7 @@ describe Gitlab::Geo::GitSSHProxy, :geo do ...@@ -137,7 +136,7 @@ describe Gitlab::Geo::GitSSHProxy, :geo do
context 'with a valid response' do context 'with a valid response' do
before do before do
stub_request(:get, full_info_refs_url).to_return(status: 200, body: info_refs_http_body_full, headers: info_refs_receive_pack_headers) stub_request(:get, full_info_refs_url).to_return(status: 200, body: info_refs_http_body_full)
end end
it 'returns a Gitlab::Geo::GitSSHProxy::APIResponse' do it 'returns a Gitlab::Geo::GitSSHProxy::APIResponse' do
......
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