summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/http_helper.rb6
-rw-r--r--spec/gitlab_net_spec.rb8
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/http_helper.rb b/lib/http_helper.rb
index b1a100e..305df48 100644
--- a/lib/http_helper.rb
+++ b/lib/http_helper.rb
@@ -7,8 +7,12 @@ module HTTPHelper
@config ||= GitlabConfig.new
end
+ def base_api_endpoint
+ "#{config.gitlab_url}/api/v4"
+ end
+
def host
- "#{config.gitlab_url}/api/v4/internal"
+ "#{base_api_endpoint}/internal"
end
def http_client_for(uri, options = {})
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index 8e06fa8..5e3b196 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -353,6 +353,14 @@ describe GitlabNet, vcr: true do
end
end
+ describe :base_api_endpoint do
+ let(:net) { GitlabNet.new }
+ subject { net.send :base_api_endpoint }
+
+ it { should include(net.send(:config).gitlab_url) }
+ it("uses API version 4") { should end_with("api/v4") }
+ end
+
describe :host do
let(:net) { GitlabNet.new }
subject { net.send :host }