hal-client 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,5 +3,6 @@ rvm:
3
3
  - "1.9.2"
4
4
  - "1.9.3"
5
5
  - "2.0.0"
6
- - ruby-head
6
+ - "2.1.0"
7
+ # - ruby-head
7
8
  - jruby-19mode # JRuby in 1.9 mode
@@ -1,3 +1,3 @@
1
1
  class HalClient
2
- VERSION = "3.1.1"
2
+ VERSION = "3.1.2"
3
3
  end
data/lib/hal_client.rb CHANGED
@@ -139,7 +139,7 @@ class HalClient
139
139
 
140
140
  # Returns an HTTP client.
141
141
  def base_client
142
- @base_client ||= HTTP::Client.new
142
+ @base_client ||= HTTP::Client.new(follow: true)
143
143
  end
144
144
 
145
145
  attr_reader :default_entity_request_headers, :default_message_request_headers
@@ -224,6 +224,20 @@ describe HalClient do
224
224
  end
225
225
  end
226
226
 
227
+ context "get request redirection" do
228
+ let!(:request) { stub_request(:get, "http://example.com/foo").
229
+ to_return(status: 301, headers: { 'Location' => "http://example.com/bar" } ) }
230
+
231
+ let!(:second_req) { stub_request(:get, "http://example.com/bar").
232
+ to_return(body: "{}") }
233
+
234
+ let!(:response) { client.get "http://example.com/foo" }
235
+
236
+ it "follows redirects" do
237
+ expect(second_req).to have_been_made
238
+ end
239
+ end
240
+
227
241
 
228
242
  let(:post_data) { "ABC" }
229
243
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hal-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-11 00:00:00.000000000 Z
12
+ date: 2014-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
@@ -190,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  segments:
192
192
  - 0
193
- hash: 285497498417964511
193
+ hash: 916239915633512664
194
194
  required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  none: false
196
196
  requirements:
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  version: '0'
200
200
  segments:
201
201
  - 0
202
- hash: 285497498417964511
202
+ hash: 916239915633512664
203
203
  requirements: []
204
204
  rubyforge_project:
205
205
  rubygems_version: 1.8.23