rufus-verbs 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +6 -0
- data/lib/rufus/verbs/endpoint.rb +5 -1
- data/lib/rufus/verbs/version.rb +1 -1
- data/test/redir_test.rb +14 -0
- metadata +15 -7
data/README.txt
CHANGED
@@ -204,6 +204,12 @@ the id part of a full resource path (see :base)
|
|
204
204
|
* <b>:max_redirections</b> (integer, RE)
|
205
205
|
by default, rufus-verbs will follow any number of redirections. A limit can be set via this option
|
206
206
|
|
207
|
+
* <b>:no_redirections</b> (boolean, RE)
|
208
|
+
when set to 'true', redirections will not be followed, the server response will be returned directly, even if it's a redirection notification.
|
209
|
+
|
210
|
+
* <b>:noredir</b> (boolean, RE)
|
211
|
+
the short version for :no_redirections.
|
212
|
+
|
207
213
|
* <b>:nozip</b> (boolean, RE)
|
208
214
|
if set to true will prevent gzip encoding (advertising) when GETting content
|
209
215
|
|
data/lib/rufus/verbs/endpoint.rb
CHANGED
@@ -477,8 +477,10 @@ module Verbs
|
|
477
477
|
#
|
478
478
|
def handle_response (method, res, opts)
|
479
479
|
|
480
|
+
nored = o(opts, [ :no_redirections, :noredir ])
|
481
|
+
|
480
482
|
#if res.is_a?(Net::HTTPRedirection)
|
481
|
-
if [ 301, 303, 307 ].include?(res.code.to_i)
|
483
|
+
if [ 301, 303, 307 ].include?(res.code.to_i) and (nored != true)
|
482
484
|
|
483
485
|
maxr = o(opts, :max_redirections)
|
484
486
|
|
@@ -514,6 +516,8 @@ module Verbs
|
|
514
516
|
opts[:query] = query_to_h opts[:query]
|
515
517
|
|
516
518
|
return request(method, opts)
|
519
|
+
#
|
520
|
+
# following the redirection
|
517
521
|
end
|
518
522
|
|
519
523
|
decompress res
|
data/lib/rufus/verbs/version.rb
CHANGED
data/test/redir_test.rb
CHANGED
@@ -23,4 +23,18 @@ class RedirTest < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
expect 200, {}, get(:uri => "http://localhost:7777/things")
|
25
25
|
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# testing the :no_redirections directive
|
29
|
+
#
|
30
|
+
def test_1
|
31
|
+
|
32
|
+
res = get "http://localhost:7777/things", :no_redirections => true
|
33
|
+
assert_equal 303, res.code.to_i
|
34
|
+
|
35
|
+
res = get("http://localhost:7777/things", :noredir => true)
|
36
|
+
assert_equal 303, res.code.to_i
|
37
|
+
|
38
|
+
expect 200, {}, get("http://localhost:7777/items", :noredir => true)
|
39
|
+
end
|
26
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-verbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.4"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,10 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-01-
|
12
|
+
date: 2008-01-28 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rufus-lru
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
16
24
|
description:
|
17
25
|
email: john at openwfe dot org
|
18
26
|
executables: []
|
@@ -48,7 +56,7 @@ files:
|
|
48
56
|
- test/testbase.rb
|
49
57
|
- README.txt
|
50
58
|
has_rdoc: true
|
51
|
-
homepage: http://rufus.rubyforge.org/
|
59
|
+
homepage: http://rufus.rubyforge.org/rufus-verbs
|
52
60
|
post_install_message:
|
53
61
|
rdoc_options: []
|
54
62
|
|
@@ -66,8 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
74
|
- !ruby/object:Gem::Version
|
67
75
|
version: "0"
|
68
76
|
version:
|
69
|
-
requirements:
|
70
|
-
|
77
|
+
requirements:
|
78
|
+
- rufus-lru
|
71
79
|
rubyforge_project:
|
72
80
|
rubygems_version: 0.9.5
|
73
81
|
signing_key:
|