Skip to content

Commit

Permalink
Merge pull request #60 from dblock/follow-redirects
Browse files Browse the repository at this point in the history
Follow redirects, fixes #58.
  • Loading branch information
oriolgual committed Sep 26, 2014
2 parents ff3e85c + f4f1ba9 commit ee215c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
== Next
* enhancements
* [#58](https://github.com/codegram/hyperclient/issues/58): Automatically follow redirects (by [@dblock](https://github.com/dblock)).

== 0.3.1
* backwards incompatible changes
* Nothing
* Nothing.

* enhancements
* Support arrays of Links (by @rehevkor5)
* Support arrays of Links (by @rehevkor5).
* Created the CHANGELOG.

* bug fix
* Nothing
* bug fixes
* Nothing.

* deprecations
* Nothing
* Nothing.
1 change: 1 addition & 0 deletions lib/hyperclient/entry_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def connection
# Returns a block.
def default_faraday_block
lambda do |faraday|
faraday.use FaradayMiddleware::FollowRedirects
faraday.request :json
faraday.response :json, content_type: /\bjson$/
faraday.adapter :net_http
Expand Down
3 changes: 2 additions & 1 deletion test/hyperclient/entry_point_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Hyperclient

it 'creates a Faraday connection with the default block' do
handlers = entry_point.connection.builder.handlers
handlers.must_include FaradayMiddleware::FollowRedirects
handlers.must_include FaradayMiddleware::EncodeJson
handlers.must_include FaradayMiddleware::ParseJson
handlers.must_include Faraday::Adapter::NetHttp
Expand All @@ -31,4 +32,4 @@ module Hyperclient
end
end
end
end
end

0 comments on commit ee215c0

Please sign in to comment.