rest 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -4
- data/lib/rest/version.rb +1 -1
- data/lib/rest/wrappers/net_http_persistent_wrapper.rb +5 -2
- data/test/test_rest.rb +12 -0
- metadata +1 -1
data/Gemfile.lock
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest (1.
|
4
|
+
rest (1.2.0)
|
5
|
+
net-http-persistent
|
5
6
|
rest-client (>= 0.3.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
ffi (1.0.11)
|
11
|
-
mime-types (1.
|
12
|
+
mime-types (1.19)
|
12
13
|
net-http-persistent (2.7)
|
13
14
|
quicky (0.0.1)
|
14
15
|
rake (0.9.2.2)
|
15
16
|
rest-client (1.6.7)
|
16
17
|
mime-types (>= 1.16)
|
17
|
-
test-unit (2.5.
|
18
|
+
test-unit (2.5.1)
|
18
19
|
typhoeus (0.4.2)
|
19
20
|
ffi (~> 1.0)
|
20
21
|
mime-types (~> 1.18)
|
@@ -24,7 +25,6 @@ PLATFORMS
|
|
24
25
|
ruby
|
25
26
|
|
26
27
|
DEPENDENCIES
|
27
|
-
net-http-persistent
|
28
28
|
quicky
|
29
29
|
rake
|
30
30
|
rest!
|
data/lib/rest/version.rb
CHANGED
@@ -35,7 +35,10 @@ module Rest
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def default_headers
|
38
|
-
{
|
38
|
+
{
|
39
|
+
"Accept-Encoding" => "gzip, deflate",
|
40
|
+
#"Accept" => "*/*; q=0.5, application/xml"
|
41
|
+
}
|
39
42
|
end
|
40
43
|
|
41
44
|
def add_headers(post, req_hash, default_headers)
|
@@ -56,7 +59,7 @@ module Rest
|
|
56
59
|
uri = URI(url)
|
57
60
|
#p uri
|
58
61
|
#p uri.path
|
59
|
-
post = Net::HTTP::Get.new fix_path(uri.
|
62
|
+
post = Net::HTTP::Get.new fix_path(uri.request_uri)
|
60
63
|
add_headers(post, req_hash, default_headers)
|
61
64
|
response = http.request uri, post
|
62
65
|
@client.logger.debug response.class.name
|
data/test/test_rest.rb
CHANGED
@@ -22,6 +22,18 @@ class TestTests < TestBase
|
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
|
+
def test_gets
|
26
|
+
@token = "abctoken"
|
27
|
+
headers = {
|
28
|
+
'Content-Type' => 'application/json',
|
29
|
+
'Authorization' => "OAuth #{@token}",
|
30
|
+
'User-Agent' => "someagent"
|
31
|
+
}
|
32
|
+
body = {"foo" => "bar"}
|
33
|
+
response = @rest.get("http://requestb.in/16q6zwq1?param1=x")
|
34
|
+
|
35
|
+
end
|
36
|
+
|
25
37
|
def test_post_with_headers
|
26
38
|
|
27
39
|
@token = "abctoken"
|