octokit 1.15.0 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  # CHANGELOG
2
2
 
3
+ * [1.15.1 - September 24,2012](https://github.com/pengwynn/octokit/compare/v1.15.0...v1.15.1)
3
4
  * [1.15.0 - September 24,2012](https://github.com/pengwynn/octokit/compare/v1.14.0...v1.15.0)
4
5
  * [1.14.0 - September 22,2012](https://github.com/pengwynn/octokit/compare/v1.13.0...v1.14.0)
5
6
  * [1.13.0 - September 5, 2012](https://github.com/pengwynn/octokit/compare/v1.12.0...v1.13.0)
@@ -15,6 +15,7 @@ module Octokit
15
15
  :client_id,
16
16
  :client_secret,
17
17
  :user_agent,
18
+ :request_host,
18
19
  :auto_traversal,
19
20
  :per_page].freeze
20
21
 
@@ -58,6 +59,7 @@ module Octokit
58
59
  self.oauth_token = nil
59
60
  self.client_id = nil
60
61
  self.client_secret = nil
62
+ self.request_host = nil
61
63
  self.user_agent = DEFAULT_USER_AGENT
62
64
  self.auto_traversal = DEFAULT_AUTO_TRAVERSAL
63
65
  end
@@ -54,6 +54,8 @@ module Octokit
54
54
  request.body = options unless options.empty?
55
55
  end
56
56
  end
57
+
58
+ request.headers['Host'] = Octokit.request_host if Octokit.request_host
57
59
  end
58
60
 
59
61
  if raw
@@ -1,3 +1,3 @@
1
1
  module Octokit
2
- VERSION = "1.15.0" unless defined?(Octokit::VERSION)
2
+ VERSION = "1.15.1" unless defined?(Octokit::VERSION)
3
3
  end
@@ -106,5 +106,38 @@ describe Octokit::Client do
106
106
  end
107
107
  end
108
108
 
109
+ describe "request_host" do
110
+ after(:each) { Octokit.reset }
111
+
112
+ it "should default to nil" do
113
+ client = Octokit::Client.new
114
+ client.request_host.should be_nil
115
+ end
116
+
117
+ it "should be settable" do
118
+ Octokit.request_host = 'github.company.com'
119
+ client = Octokit::Client.new
120
+ client.request_host.should == 'github.company.com'
121
+ end
122
+
123
+ it "does not change the Host header when not set" do
124
+ Octokit.api_endpoint = 'http://github.internal'
125
+
126
+ stub_request(:any, /.*/)
127
+ req = stub_request(:get, 'http://github.internal/users/me').with(:headers => { 'Host' => /.*/})
128
+ Octokit.user "me"
129
+ req.should_not have_been_requested
130
+ end
131
+
132
+ it "changes the Host header when set" do
133
+ Octokit.api_endpoint = 'http://github.internal'
134
+ Octokit.request_host = 'github.company.com'
135
+
136
+ req = stub_request(:get, 'http://github.internal/users/me').with(:headers => { 'Host' => 'github.company.com' })
137
+ Octokit.user "me"
138
+ req.should have_been_requested
139
+ end
140
+ end
141
+
109
142
 
110
143
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.15.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: