rufus-sixjo 0.1.1 → 0.1.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/sixjo.rb +10 -1
- data/test/ft_8_head.rb +37 -0
- data/test/test.rb +1 -0
- data/test/testmixins.rb +1 -1
- metadata +3 -2
data/README.txt
CHANGED
data/lib/rufus/sixjo.rb
CHANGED
@@ -65,7 +65,7 @@ module Rufus
|
|
65
65
|
|
66
66
|
module Sixjo
|
67
67
|
|
68
|
-
VERSION = '0.1.
|
68
|
+
VERSION = '0.1.2'
|
69
69
|
|
70
70
|
#
|
71
71
|
# Sixjo's Rack app
|
@@ -146,6 +146,7 @@ module Rufus
|
|
146
146
|
#puts env.inspect
|
147
147
|
|
148
148
|
if rm == 'POST'
|
149
|
+
|
149
150
|
md = R_METHOD.match(env['QUERY_STRING'])
|
150
151
|
rm = md[1].upcase if md
|
151
152
|
|
@@ -157,6 +158,10 @@ module Rufus
|
|
157
158
|
hidden_method = request.POST['_method']
|
158
159
|
rm = hidden_method.upcase if hidden_method
|
159
160
|
end
|
161
|
+
|
162
|
+
elsif rm == 'HEAD'
|
163
|
+
|
164
|
+
rm = 'GET'
|
160
165
|
end
|
161
166
|
|
162
167
|
raise "unknown HTTP method '#{rm}'" unless H_METHODS.include?(rm)
|
@@ -262,6 +267,10 @@ module Rufus
|
|
262
267
|
r.response.body = e.to_s + "\n" + e.backtrace.join("\n")
|
263
268
|
end
|
264
269
|
|
270
|
+
r.response.body = [] if env['REQUEST_METHOD'] == 'HEAD'
|
271
|
+
#
|
272
|
+
# remove body in case of HEAD
|
273
|
+
|
265
274
|
r.response.finish
|
266
275
|
end
|
267
276
|
|
data/test/ft_8_head.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing rufus-sixjo
|
4
|
+
#
|
5
|
+
# jmettraux at gmail.org
|
6
|
+
#
|
7
|
+
# Fri Aug 8 15:14:45 JST 2008
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
require 'testmixins'
|
12
|
+
|
13
|
+
#
|
14
|
+
# the "test" app
|
15
|
+
#
|
16
|
+
module HeadApp
|
17
|
+
extend Rufus::Sixjo
|
18
|
+
|
19
|
+
get '/toto' do
|
20
|
+
"toto"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class HeadTest < Test::Unit::TestCase
|
25
|
+
include SixjoTestMixin
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@app = HeadApp.new_sixjo_rack_app(nil, :environment => 'test')
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_0
|
32
|
+
|
33
|
+
assert_equal 200, head('/toto').status
|
34
|
+
assert_equal '', @response.body
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
data/test/test.rb
CHANGED
data/test/testmixins.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-sixjo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-05 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- test/ft_5_put.rb
|
42
42
|
- test/ft_6_h.rb
|
43
43
|
- test/ft_7_etag.rb
|
44
|
+
- test/ft_8_head.rb
|
44
45
|
- test/test.rb
|
45
46
|
- test/testmixins.rb
|
46
47
|
- README.txt
|