Skip to content

Commit 34fb0b7

Browse files
committed
[CLIENT] Make Typhoeus work out of the box
1 parent 8f9f6a7 commit 34fb0b7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

elasticsearch-transport/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Features overview:
2929

3030
For optimal performance, you should use a HTTP library which supports persistent ("keep-alive") connections,
3131
e.g. [Patron](https://github.com/toland/patron) or [Typhoeus](https://github.com/typhoeus/typhoeus).
32-
Just `require 'patron'` or `require 'typhoeus'; require 'typhoeus/adapters/faraday'` in your code,
32+
Just `require 'patron'` or `require 'typhoeus'` in your code,
3333
and it will be automatically used; other automatically used libraries are
3434
[HTTPClient](https://rubygems.org/gems/httpclient) and
3535
[Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent).

elasticsearch-transport/lib/elasticsearch/transport/client.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def initialize(arguments={})
9999
@transport = arguments[:transport] || begin
100100
if transport_class == Transport::HTTP::Faraday
101101
transport_class.new(:hosts => __extract_hosts(hosts, arguments), :options => arguments) do |faraday|
102-
faraday.adapter(arguments[:adapter] || __auto_detect_adapter)
102+
adapter = arguments[:adapter] || __auto_detect_adapter
103+
require "typhoeus/adapters/faraday" if adapter == :typhoeus
104+
faraday.adapter(adapter)
103105
end
104106
else
105107
transport_class.new(:hosts => __extract_hosts(hosts, arguments), :options => arguments)

0 commit comments

Comments
 (0)