emmy-extends 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/emmy-extends.gemspec +1 -1
- data/lib/emmy_extends/em_http_request/adapter.rb +2 -1
- data/lib/emmy_extends/httpi/adapter.rb +2 -1
- data/lib/emmy_extends/httpi/operation.rb +1 -1
- data/lib/emmy_extends/httpi.rb +5 -0
- data/lib/emmy_extends/version.rb +1 -1
- data/spec/em_http_request_spec.rb +25 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1624f89876a6b983feb2ef303af554bf028d0c9f
|
4
|
+
data.tar.gz: ab8447a5126604596a62355ff97e13a81d2f7171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ff72bae48a52032402d089316ce980c26031b3620199944d84286a1dac803fbbd92b1372e4a739fffa14f79b582a3203751d0704e4c98f1d24e7cfd24340495
|
7
|
+
data.tar.gz: 4d45bb4c53a18dd946634681f8267cd05af034c42a439e88ca62ccb11287256773e07976ec4e4f85a49c98e5d8eafb753034664fe0b32fc49119bb811f2c6667
|
data/Gemfile
CHANGED
data/emmy-extends.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "emmy-machine", "~> 0.1"
|
22
22
|
spec.add_dependency "emmy-http", "~> 0.1"
|
23
23
|
|
24
|
-
spec.add_development_dependency "eventmachine", "~> 1.
|
24
|
+
spec.add_development_dependency "eventmachine", "~> 1.2.1"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3"
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.7"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -125,7 +125,7 @@ module EmmyExtends
|
|
125
125
|
def request_options
|
126
126
|
{
|
127
127
|
redirects: 5,
|
128
|
-
keepalive:
|
128
|
+
keepalive: operation.request.keep_alive,
|
129
129
|
path: url.path,
|
130
130
|
query: url.query,
|
131
131
|
body: encode_body(body),
|
@@ -178,6 +178,7 @@ module EmmyExtends
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def setup_http_request
|
181
|
+
# return EventMachine::HttpConnection
|
181
182
|
@http_request = EventMachine::HttpRequest.new(url, connection_options)
|
182
183
|
end
|
183
184
|
|
data/lib/emmy_extends/httpi.rb
CHANGED
data/lib/emmy_extends/version.rb
CHANGED
@@ -69,4 +69,29 @@ describe EmmyExtends::EmHttpRequest do
|
|
69
69
|
expect(response.content_type).to eq("application/json")
|
70
70
|
expect(response.content["json"]).to include('points' => [{'x' => 5, 'y' => 6}, {'x' => 3, 'y' => 2}])
|
71
71
|
end
|
72
|
+
|
73
|
+
it "sends two request one by one over single connection" do
|
74
|
+
req1 = EmmyHttp::Request.new(
|
75
|
+
type: 'get',
|
76
|
+
url: 'http://httpbin.org/get',
|
77
|
+
query: {param: 5},
|
78
|
+
keep_alive: true
|
79
|
+
)
|
80
|
+
|
81
|
+
req2 = req1.copy
|
82
|
+
# change query params
|
83
|
+
req2.query = {param: 10}
|
84
|
+
|
85
|
+
op1 = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new)
|
86
|
+
res1 = op1.sync
|
87
|
+
|
88
|
+
op2 = EmmyHttp::Operation.new(request, EmmyExtends::EmHttpRequest::Adapter.new, op1.connection)
|
89
|
+
res2 = op2.sync
|
90
|
+
p res2
|
91
|
+
|
92
|
+
expect(res1).to_not be nil
|
93
|
+
expect(res1.status).to be 200
|
94
|
+
expect(res2).to_not be nil
|
95
|
+
expect(res2.status).to be 200
|
96
|
+
end
|
72
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-extends
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: emmy-machine
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.2.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.2.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.6.6
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Emmy support em-http-request, thin, savon, mysql2 etc.
|