about summary refs log tree commit
path: root/lib/metropolis/common.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-23 12:51:38 -0800
committerEric Wong <normalperson@yhbt.net>2010-11-23 12:51:54 -0800
commite232eef239952d94220d87ae9be5b27690fe6699 (patch)
tree9ac421eab03cf39852abf6ef372d3e3fdb03004a /lib/metropolis/common.rb
parente83353f18f4813365581be81672eaf2e3c2e3d3a (diff)
downloadmetropolis-e232eef239952d94220d87ae9be5b27690fe6699.tar.gz
add generic Rack read/write test
This fixes 404s on HEAD requests which do not return a body.
Diffstat (limited to 'lib/metropolis/common.rb')
-rw-r--r--lib/metropolis/common.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/metropolis/common.rb b/lib/metropolis/common.rb
index b86102d..3bfbf77 100644
--- a/lib/metropolis/common.rb
+++ b/lib/metropolis/common.rb
@@ -2,8 +2,8 @@
 module Metropolis::Common
   include Rack::Utils # unescape
 
-  def r(code)
-    body = "#{HTTP_STATUS_CODES[code]}\n"
+  def r(code, body = nil)
+    body ||= "#{HTTP_STATUS_CODES[code]}\n"
     [ code,
       { 'Content-Length' => body.size.to_s, 'Content-Type' => 'text/plain' },
       [ body ] ]