elasticsearch-transport 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +6 -2
- data/lib/elasticsearch/transport/transport/http/faraday.rb +2 -1
- data/lib/elasticsearch/transport/transport/response.rb +1 -0
- data/lib/elasticsearch/transport/version.rb +1 -1
- data/test/unit/response_test.rb +15 -0
- data/test/unit/transport_faraday_test.rb +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWFlNjhjYzk0N2Q0NGE0OTVkNzc5ODY3Y2Q2YTQ0YTVmMjgwOWYwYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTIyNzc1OGM0YzE3YWNiMDYzZjcyZjljYjMzNzA4OWI5MDNhMGM0Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmQzY2JiODk5Yjg3Njc0ZmY3MWU4N2IwOTRmN2IzYjhmYjExYjczNGI2M2Rj
|
10
|
+
OTE5NDVkNTNkNGY1N2E4MDRmN2FlODI1MTQ5OGE0MDU5MTg2YWIyMTU0MGY5
|
11
|
+
NjY2ZWRmMmZmYmE0MmVjNGMzMGQyMGEwYjk1YWFjMjgxNmIyNTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjEwZmI5YjIyYWNlMzM0ZGY1NmU3MzRiNDZmMGJlZjhmMTNjMDNjOTZiNGQx
|
14
|
+
ZDI1MjYyMjhkN2U3NjJkOTE5ZjNhMmQ2MDkxMzIxODQxYmZjYzdhY2UyZTk2
|
15
|
+
YWQyYzc0OGE2NWJmZDMzMTNmMGExZGEzN2I5MGJmNDFmMDQ0OGE=
|
data/README.md
CHANGED
@@ -28,8 +28,12 @@ Features overview:
|
|
28
28
|
* Node reloading (based on cluster state) on errors or on demand
|
29
29
|
|
30
30
|
For optimal performance, you should use a HTTP library which supports persistent ("keep-alive") connections,
|
31
|
-
e.g. [
|
32
|
-
Just `require '
|
31
|
+
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,
|
33
|
+
and it will be automatically used; other automatically used libraries are
|
34
|
+
[HTTPClient](https://rubygems.org/gems/httpclient) and
|
35
|
+
[Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent).
|
36
|
+
|
33
37
|
For detailed information, see example configurations [below](#transport-implementations).
|
34
38
|
|
35
39
|
## Installation
|
@@ -18,11 +18,12 @@ module Elasticsearch
|
|
18
18
|
#
|
19
19
|
def perform_request(method, path, params={}, body=nil)
|
20
20
|
super do |connection, url|
|
21
|
-
connection.connection.run_request \
|
21
|
+
response = connection.connection.run_request \
|
22
22
|
method.downcase.to_sym,
|
23
23
|
url,
|
24
24
|
( body ? __convert_to_json(body) : nil ),
|
25
25
|
{}
|
26
|
+
Response.new response.status, response.body, response.headers
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Elasticsearch::Transport::Transport::ResponseTest < Test::Unit::TestCase
|
4
|
+
context "Response" do
|
5
|
+
|
6
|
+
should "force-encode the body into UTF" do
|
7
|
+
body = "Hello Encoding!".encode(Encoding::ISO_8859_1)
|
8
|
+
assert_equal 'ISO-8859-1', body.encoding.name
|
9
|
+
|
10
|
+
response = Elasticsearch::Transport::Transport::Response.new 200, body
|
11
|
+
assert_equal 'UTF-8', response.body.encoding.name
|
12
|
+
end unless RUBY_1_8
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -25,6 +25,12 @@ class Elasticsearch::Transport::Transport::HTTP::FaradayTest < Test::Unit::TestC
|
|
25
25
|
@transport.perform_request 'GET', '/'
|
26
26
|
end
|
27
27
|
|
28
|
+
should "return a Response" do
|
29
|
+
@transport.connections.first.connection.expects(:run_request).returns(stub_everything)
|
30
|
+
response = @transport.perform_request 'GET', '/'
|
31
|
+
assert_instance_of Elasticsearch::Transport::Transport::Response, response
|
32
|
+
end
|
33
|
+
|
28
34
|
should "properly prepare the request" do
|
29
35
|
@transport.connections.first.connection.expects(:run_request).with do |method, url, body, headers|
|
30
36
|
:post == method && '{"foo":"bar"}' == body
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -358,6 +358,7 @@ files:
|
|
358
358
|
- test/unit/connection_collection_test.rb
|
359
359
|
- test/unit/connection_selector_test.rb
|
360
360
|
- test/unit/connection_test.rb
|
361
|
+
- test/unit/response_test.rb
|
361
362
|
- test/unit/serializer_test.rb
|
362
363
|
- test/unit/sniffer_test.rb
|
363
364
|
- test/unit/transport_base_test.rb
|
@@ -397,6 +398,7 @@ test_files:
|
|
397
398
|
- test/unit/connection_collection_test.rb
|
398
399
|
- test/unit/connection_selector_test.rb
|
399
400
|
- test/unit/connection_test.rb
|
401
|
+
- test/unit/response_test.rb
|
400
402
|
- test/unit/serializer_test.rb
|
401
403
|
- test/unit/sniffer_test.rb
|
402
404
|
- test/unit/transport_base_test.rb
|