From e232eef239952d94220d87ae9be5b27690fe6699 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Nov 2010 12:51:38 -0800 Subject: add generic Rack read/write test This fixes 404s on HEAD requests which do not return a body. --- lib/metropolis/common.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/metropolis/common.rb') 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 ] ] -- cgit v1.2.3-24-ge0c7