tilia-http 4.1.0.3 → 4.1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/client.rb +1 -1
- data/examples/reverseproxy.rb +1 -1
- data/lib/tilia/http/client.rb +4 -4
- data/lib/tilia/http/version.rb +1 -1
- data/test/http/client_test.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c431ff418e1a762240f228f4377aa5e5bcd72cde
|
4
|
+
data.tar.gz: 70a61b39407f8c123855c72d70b9f4db5c21844e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4014e54c6b40c0849ba916eac8dde2f7a59553dd72d8932eaffd6d2373bf57bb94ce22a04bfca9ed6042f647f5d8e6b8dd6b26b8281fd910325e27dcbb44357d
|
7
|
+
data.tar.gz: 820e94c7bec2806b39d015ef8a396455e13a1431d2dd2ee0675ee6365b1f0af527662fa19b0ecef2175012548df5d9297f12dcac13784b1ab502716220aa84c7
|
data/examples/client.rb
CHANGED
@@ -14,7 +14,7 @@ request = Tilia::Http::Request.new('GET', 'http://www.jakobsack.de/')
|
|
14
14
|
|
15
15
|
client = Tilia::Http::Client.new
|
16
16
|
# client.add_curl_setting(proxy: 'localhost:8888')
|
17
|
-
response = client.
|
17
|
+
response = client.send_request(request)
|
18
18
|
|
19
19
|
puts 'Response:'
|
20
20
|
puts response.to_s
|
data/examples/reverseproxy.rb
CHANGED
@@ -30,7 +30,7 @@ app = proc do |env|
|
|
30
30
|
client = Tilia::Http::Client.new
|
31
31
|
|
32
32
|
# Sends the HTTP request to the server
|
33
|
-
response = client.
|
33
|
+
response = client.send_request(sub_request)
|
34
34
|
|
35
35
|
# Sends the response back to the client that connected to the proxy.
|
36
36
|
sapi.send_response(response)
|
data/lib/tilia/http/client.rb
CHANGED
@@ -59,7 +59,7 @@ module Tilia
|
|
59
59
|
@hydra = nil
|
60
60
|
@throw_exceptions = false
|
61
61
|
@max_redirects = 5
|
62
|
-
@
|
62
|
+
@curl_settings = {
|
63
63
|
header: false, # RUBY otherwise header will be part of response.body
|
64
64
|
nobody: false
|
65
65
|
}
|
@@ -70,7 +70,7 @@ module Tilia
|
|
70
70
|
#
|
71
71
|
# @param RequestInterface request
|
72
72
|
# @return [ResponseInterface]
|
73
|
-
def
|
73
|
+
def send_request(request)
|
74
74
|
emit('beforeRequest', [request])
|
75
75
|
|
76
76
|
retry_count = 0
|
@@ -261,7 +261,7 @@ module Tilia
|
|
261
261
|
# @param mixed value
|
262
262
|
# @return [void]
|
263
263
|
def add_curl_setting(name, value)
|
264
|
-
@
|
264
|
+
@curl_settings[name] = value
|
265
265
|
end
|
266
266
|
|
267
267
|
protected
|
@@ -403,7 +403,7 @@ module Tilia
|
|
403
403
|
# TODO: document
|
404
404
|
def create_client(request)
|
405
405
|
settings = {}
|
406
|
-
@
|
406
|
+
@curl_settings.each do |key, value|
|
407
407
|
settings[key] = value
|
408
408
|
end
|
409
409
|
|
data/lib/tilia/http/version.rb
CHANGED
data/test/http/client_test.rb
CHANGED
@@ -116,7 +116,7 @@ module Tilia
|
|
116
116
|
end
|
117
117
|
)
|
118
118
|
|
119
|
-
response = client.
|
119
|
+
response = client.send_request(request)
|
120
120
|
|
121
121
|
assert_equal(200, response.status)
|
122
122
|
end
|
@@ -140,7 +140,7 @@ module Tilia
|
|
140
140
|
end
|
141
141
|
)
|
142
142
|
|
143
|
-
assert_raises(ClientException) { client.
|
143
|
+
assert_raises(ClientException) { client.send_request(request) }
|
144
144
|
|
145
145
|
assert(called)
|
146
146
|
end
|
@@ -170,7 +170,7 @@ module Tilia
|
|
170
170
|
end
|
171
171
|
)
|
172
172
|
|
173
|
-
client.
|
173
|
+
client.send_request(request)
|
174
174
|
assert_equal(2, called)
|
175
175
|
end
|
176
176
|
|
@@ -200,7 +200,7 @@ module Tilia
|
|
200
200
|
end
|
201
201
|
)
|
202
202
|
|
203
|
-
response = client.
|
203
|
+
response = client.send_request(request)
|
204
204
|
assert_equal(3, called)
|
205
205
|
assert_equal(2, error_called)
|
206
206
|
assert_equal(200, response.status)
|
@@ -218,7 +218,7 @@ module Tilia
|
|
218
218
|
end
|
219
219
|
)
|
220
220
|
|
221
|
-
error = assert_raises(Exception) { client.
|
221
|
+
error = assert_raises(Exception) { client.send_request(request) }
|
222
222
|
assert_kind_of(ClientHttpException, error)
|
223
223
|
assert_equal(404, error.http_status)
|
224
224
|
assert_kind_of(Response, error.response)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilia-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.0.
|
4
|
+
version: 4.1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Sack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|