manticore 0.4.2-java → 0.4.3-java
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +15 -2
- data/Gemfile +1 -1
- data/LICENSE.txt +0 -0
- data/README.md +3 -3
- data/Rakefile +0 -0
- data/ext/manticore/org/manticore/Manticore.java +0 -0
- data/lib/faraday/adapter/manticore.rb +11 -1
- data/lib/manticore/client.rb +58 -26
- data/lib/manticore/stubbed_response.rb +9 -5
- data/lib/manticore/version.rb +1 -1
- data/manticore.gemspec +0 -0
- data/spec/manticore/client_proxy_spec.rb +22 -22
- data/spec/manticore/client_spec.rb +152 -148
- data/spec/manticore/cookie_spec.rb +9 -9
- data/spec/manticore/facade_spec.rb +8 -8
- data/spec/manticore/response_spec.rb +16 -16
- data/spec/manticore/stubbed_response_spec.rb +20 -15
- metadata +12 -12
- metadata.gz.sig +0 -0
@@ -5,14 +5,14 @@ describe Manticore::Cookie do
|
|
5
5
|
let(:client) { Manticore::Client.new cookies: true }
|
6
6
|
subject {
|
7
7
|
response = client.get(local_server("/cookies/1/2"))
|
8
|
-
response.final_url.to_s.
|
8
|
+
expect(response.final_url.to_s).to eq local_server("/cookies/2/2")
|
9
9
|
response.cookies["x"].first
|
10
10
|
}
|
11
11
|
|
12
|
-
its(:name) {
|
13
|
-
its(:value) {
|
14
|
-
its(:path) {
|
15
|
-
its(:domain) {
|
12
|
+
its(:name) { is_expected.to eq "x" }
|
13
|
+
its(:value) { is_expected.to eq "2" }
|
14
|
+
its(:path) { is_expected.to eq "/" }
|
15
|
+
its(:domain) { is_expected.to eq "localhost" }
|
16
16
|
end
|
17
17
|
|
18
18
|
|
@@ -21,16 +21,16 @@ describe Manticore::Cookie do
|
|
21
21
|
Manticore::Cookie.new({name: "foo", value: "bar"}.merge(opts))
|
22
22
|
}
|
23
23
|
|
24
|
-
its(:secure?) {
|
25
|
-
its(:persistent?) {
|
24
|
+
its(:secure?) { is_expected.to be nil }
|
25
|
+
its(:persistent?) { is_expected.to be nil }
|
26
26
|
|
27
27
|
context "created as secure" do
|
28
28
|
let(:opts) {{ secure: true }}
|
29
|
-
its(:secure?) {
|
29
|
+
its(:secure?) { is_expected.to be true }
|
30
30
|
end
|
31
31
|
|
32
32
|
context "created as persistent" do
|
33
33
|
let(:opts) {{ persistent: true }}
|
34
|
-
its(:persistent?) {
|
34
|
+
its(:persistent?) { is_expected.to be true }
|
35
35
|
end
|
36
36
|
end
|
@@ -16,26 +16,26 @@ describe Manticore::Facade do
|
|
16
16
|
end
|
17
17
|
}
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "gets a response" do
|
20
20
|
result = JSON.parse extended_class.get(local_server).body
|
21
|
-
result["method"].
|
21
|
+
expect(result["method"]).to eq "GET"
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
25
|
-
extended_class.instance_variable_get("@manticore_facade").object_id.
|
24
|
+
it "does not use the shared client by default" do
|
25
|
+
expect(extended_class.instance_variable_get("@manticore_facade").object_id).to_not eq \
|
26
26
|
Manticore.instance_variable_get("@manticore_facade").object_id
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
30
|
-
extended_shared_class.instance_variable_get("@manticore_facade").object_id.
|
29
|
+
it "is able to use the shared client" do
|
30
|
+
expect(extended_shared_class.instance_variable_get("@manticore_facade").object_id).to eq \
|
31
31
|
Manticore.instance_variable_get("@manticore_facade").object_id
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
context "from the default Manticore module" do
|
36
|
-
it "
|
36
|
+
it "gets a response" do
|
37
37
|
result = JSON.parse Manticore.get(local_server).body
|
38
|
-
result["method"].
|
38
|
+
expect(result["method"]).to eq "GET"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -4,36 +4,36 @@ describe Manticore::Response do
|
|
4
4
|
let(:client) { Manticore::Client.new }
|
5
5
|
subject { client.get( local_server ) }
|
6
6
|
|
7
|
-
its(:headers) {
|
8
|
-
its(:body) {
|
9
|
-
its(:length) {
|
7
|
+
its(:headers) { is_expected.to be_a Hash }
|
8
|
+
its(:body) { is_expected.to be_a String }
|
9
|
+
its(:length) { is_expected.to be_a Fixnum }
|
10
10
|
|
11
|
-
it "
|
12
|
-
subject["Content-Type"].
|
11
|
+
it "provides response header lookup via #[]" do
|
12
|
+
expect(subject["Content-Type"]).to eq "text/plain"
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
16
|
-
subject.body.
|
15
|
+
it "reads the body" do
|
16
|
+
expect(subject.body).to match "Manticore"
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
20
|
-
subject.code.
|
19
|
+
it "reads the status code" do
|
20
|
+
expect(subject.code).to eq 200
|
21
21
|
end
|
22
22
|
|
23
|
-
it "
|
24
|
-
subject.message.
|
23
|
+
it "reads the status text" do
|
24
|
+
expect(subject.message).to match "OK"
|
25
25
|
end
|
26
26
|
|
27
27
|
context "when the client is invoked with a block" do
|
28
|
-
it "
|
28
|
+
it "allows reading the body from a block" do
|
29
29
|
response = client.get(local_server) do |response|
|
30
|
-
response.body.
|
30
|
+
expect(response.body).to match 'Manticore'
|
31
31
|
end
|
32
32
|
|
33
|
-
response.body.
|
33
|
+
expect(response.body).to match "Manticore"
|
34
34
|
end
|
35
35
|
|
36
|
-
it "
|
36
|
+
it "does not read the body implicitly if called with a block" do
|
37
37
|
response = client.get(local_server) {}
|
38
38
|
expect { response.body }.to raise_exception(Manticore::StreamClosedException)
|
39
39
|
end
|
@@ -42,7 +42,7 @@ describe Manticore::Response do
|
|
42
42
|
context "when an entity fails to read" do
|
43
43
|
it "releases the connection" do
|
44
44
|
stats_before = client.pool_stats
|
45
|
-
Manticore::EntityConverter.
|
45
|
+
expect_any_instance_of(Manticore::EntityConverter).to receive(:read_entity).and_raise(Manticore::StreamClosedException)
|
46
46
|
expect { client.get(local_server).call rescue nil }.to_not change { client.pool_stats[:available] }
|
47
47
|
end
|
48
48
|
end
|
@@ -13,32 +13,37 @@ describe Manticore::StubbedResponse do
|
|
13
13
|
).call
|
14
14
|
}
|
15
15
|
|
16
|
-
it {
|
17
|
-
its(:body) {
|
18
|
-
its(:code) {
|
16
|
+
it { is_expected.to be_a Manticore::Response }
|
17
|
+
its(:body) { is_expected.to eq "test body" }
|
18
|
+
its(:code) { is_expected.to eq 200 }
|
19
19
|
|
20
|
-
it "
|
21
|
-
subject.headers["content-type"].
|
20
|
+
it "persists the set headers" do
|
21
|
+
expect(subject.headers["content-type"]).to eq "text/plain"
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
25
|
-
subject.headers["content-length"].
|
24
|
+
it "sets content-length from the body" do
|
25
|
+
expect(subject.headers["content-length"]).to eq "9"
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
29
|
-
subject.cookies["test"].first.value.
|
28
|
+
it "persists cookies passed as explicit cookie objects" do
|
29
|
+
expect(subject.cookies["test"].first.value).to eq "something"
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "calls on_success handlers" do
|
33
33
|
called = false
|
34
34
|
Manticore::StubbedResponse.stub.on_success {|resp| called = true }.call
|
35
|
-
called.
|
35
|
+
expect(called).to be true
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should persist cookies passed in set-cookie" do
|
39
|
-
subject.cookies["k"].map(&:value).
|
40
|
-
subject.cookies["k"].map(&:path).
|
41
|
-
subject.cookies["k"].map(&:domain).
|
42
|
-
subject.cookies["k2"].first.value.
|
39
|
+
expect(subject.cookies["k"].map(&:value)).to match_array ["v", "v"]
|
40
|
+
expect(subject.cookies["k"].map(&:path)).to match_array ["/", "/sub"]
|
41
|
+
expect(subject.cookies["k"].map(&:domain)).to match_array ["localhost", "sub.localhost"]
|
42
|
+
expect(subject.cookies["k2"].first.value).to eq "v2"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "passes bodies to blocks for streaming reads" do
|
46
|
+
total = ""; subject.body {|chunk| total << chunk }
|
47
|
+
expect(total).to eq("test body")
|
43
48
|
end
|
44
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manticore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Chris Heald
|
@@ -30,12 +30,12 @@ cert_chain:
|
|
30
30
|
cnyabLOcGIKZNxvnSfwOuCBnjgoSOyJi/n48n1s+OPB/OmPJoWmhKu2DO4sUb4+K
|
31
31
|
/3Mhp5UWSl9SmDR1
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-07
|
33
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.3'
|
41
41
|
name: addressable
|
@@ -43,13 +43,13 @@ dependencies:
|
|
43
43
|
type: :runtime
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '2.3'
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
name: bundler
|
@@ -57,13 +57,13 @@ dependencies:
|
|
57
57
|
type: :development
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.3'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
name: rake
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
type: :development
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
description: Manticore is an HTTP client built on the Apache HttpCore components
|
@@ -81,8 +81,8 @@ executables: []
|
|
81
81
|
extensions: []
|
82
82
|
extra_rdoc_files: []
|
83
83
|
files:
|
84
|
-
- .gitignore
|
85
|
-
- .travis.yml
|
84
|
+
- ".gitignore"
|
85
|
+
- ".travis.yml"
|
86
86
|
- APACHE-LICENSE-2.0.txt
|
87
87
|
- CHANGELOG.md
|
88
88
|
- Gemfile
|
@@ -127,12 +127,12 @@ require_paths:
|
|
127
127
|
- lib
|
128
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
metadata.gz.sig
CHANGED
Binary file
|