rufus-verbs 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -1
- data/lib/rufus/verbs/endpoint.rb +3 -1
- data/test/proxy_test.rb +4 -7
- data/test/simple_test.rb +9 -0
- metadata +1 -1
data/README.txt
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
== what is it ?
|
5
5
|
|
6
|
-
'rufus-verbs' is an extended HTTP client library. It provides the four main HTTP "verbs" as Ruby methods : get, put, post and delete.
|
6
|
+
'rufus-verbs' is an extended HTTP client library (gem). It provides the four main HTTP "verbs" as Ruby methods : get, put, post and delete.
|
7
7
|
|
8
8
|
It wraps a certain number of techniques that make it a decent tool for manipulating web resources.
|
9
9
|
|
data/lib/rufus/verbs/endpoint.rb
CHANGED
@@ -41,7 +41,7 @@ require 'zlib'
|
|
41
41
|
module Rufus
|
42
42
|
module Verbs
|
43
43
|
|
44
|
-
VERSION = "0.
|
44
|
+
VERSION = "0.2"
|
45
45
|
USER_AGENT = "Ruby rufus-verbs #{VERSION}"
|
46
46
|
|
47
47
|
#
|
@@ -226,6 +226,8 @@ module Verbs
|
|
226
226
|
opts[:path] = r[3] || @opts[:path]
|
227
227
|
opts[:query] = r[4] || @opts[:query]
|
228
228
|
|
229
|
+
opts.delete :path if opts[:path] == ""
|
230
|
+
|
229
231
|
opts[:c_uri] = [
|
230
232
|
opts[:scheme],
|
231
233
|
opts[:host],
|
data/test/proxy_test.rb
CHANGED
@@ -20,9 +20,9 @@ class ProxyTest < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
def test_0
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
uri = "http://rufus.rubyforge.org/rufus-verbs/index.html"
|
24
|
+
|
25
|
+
res0 = get(uri, :proxy => false)
|
26
26
|
|
27
27
|
assert_not_nil res0.body # just displaying the test dot
|
28
28
|
|
@@ -33,10 +33,7 @@ class ProxyTest < Test::Unit::TestCase
|
|
33
33
|
proxies.each do |proxy|
|
34
34
|
begin
|
35
35
|
Timeout::timeout 2 do
|
36
|
-
res1 = get(
|
37
|
-
"http://en.wikipedia.org/wiki/"+
|
38
|
-
"Ruby_%28programming_language%29",
|
39
|
-
:proxy => proxy)
|
36
|
+
res1 = get(uri, :proxy => proxy)
|
40
37
|
end
|
41
38
|
break if res1.code.to_i == 200
|
42
39
|
rescue Exception => e
|
data/test/simple_test.rb
CHANGED
@@ -71,4 +71,13 @@ class SimpleTest < Test::Unit::TestCase
|
|
71
71
|
s = get(:uri => "http://localhost:7777/items", :body => true)
|
72
72
|
assert_equal "{}", s.strip
|
73
73
|
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# The "no-path" test
|
77
|
+
#
|
78
|
+
def test_3
|
79
|
+
|
80
|
+
r = get "http://rufus.rubyforge.org"
|
81
|
+
assert_kind_of Net::HTTPOK, r
|
82
|
+
end
|
74
83
|
end
|