Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make API endpoint configurable

  • Loading branch information...
commit 99ecec70fbaea6c65813ad43a2b3e086917196ac 1 parent c8d53e3
@pengwynn pengwynn authored
Showing with 6 additions and 1 deletion.
  1. +2 −1  lib/octokit/connection.rb
  2. +4 −0 spec/octokit/client_spec.rb
View
3  lib/octokit/connection.rb
@@ -9,7 +9,7 @@ module Connection
def connection(authenticate=true, raw=false, version=3, force_urlencoded=false)
case version
when 3
- url = "https://api.github.com"
+ url = Octokit.api_endpoint
end
options = {
@@ -20,6 +20,7 @@ def connection(authenticate=true, raw=false, version=3, force_urlencoded=false)
options.merge!(:params => {:access_token => oauth_token}) if oauthed? && !authenticated?
+ # TODO: Don't build on every request
connection = Faraday.new(options) do |builder|
if version >= 3 && !force_urlencoded
builder.request :json
View
4 spec/octokit/client_spec.rb
@@ -64,6 +64,10 @@
describe "api_endpoint" do
+ after(:each) do
+ Octokit.reset
+ end
+
it "should default to https://api.github.com" do
client = Octokit::Client.new
client.api_endpoint.should == 'https://api.github.com'

1 comment on commit 99ecec7

@pengwynn
Owner

To use:

Octokit.api_endpoint = 'http://foo.dev'
Octokit.user 'defunkt'

/cc @jbarnette

Please sign in to comment.
Something went wrong with that request. Please try again.