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 CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  == what is it ?
5
5
 
6
- A 'Rack application' for
6
+ A 'Rack application' for RESTfully serving stuff (the RESTful last mile is up to you). Heavily Sinatra-inspired but less polished and... Well Sixjo is not a framework.
7
7
 
8
8
 
9
9
  == features
@@ -65,7 +65,7 @@ module Rufus
65
65
 
66
66
  module Sixjo
67
67
 
68
- VERSION = '0.1.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
 
@@ -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
+
@@ -7,4 +7,5 @@ require 'ft_4_configure'
7
7
  require 'ft_5_put'
8
8
  require 'ft_6_h'
9
9
  require 'ft_7_etag'
10
+ require 'ft_8_head'
10
11
 
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  module SixjoTestMixin
31
31
 
32
- [ :post, :get, :put, :delete ].each do |v|
32
+ [ :post, :get, :put, :delete, :head ].each do |v|
33
33
  module_eval <<-EOS
34
34
  def #{v} (path, options={})
35
35
  @response = \
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.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-08-28 00:00:00 +09:00
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