From a427d4a1b0c17c7f063117e0d5bad0a383f5a265 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sun, 30 Dec 2007 11:16:15 +0000 Subject: [PATCH] prototype: jstest.rb cleanup. --- test/lib/jstest.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/lib/jstest.rb b/test/lib/jstest.rb index 1ebe6b9..6a7c0c5 100644 --- a/test/lib/jstest.rb +++ b/test/lib/jstest.rb @@ -207,21 +207,12 @@ class WEBrick::HTTPServlet::AbstractServlet res['Pragma'] = 'no-cache' res['Expires'] = Time.now - 100**4 end - - def set_default_content_type(res, path) - res['Content-Type'] = case path - when /\.js$/ then 'text/javascript' - when /\.html$/ then 'text/html' - when /\.css$/ then 'text/css' - else 'text/plain' - end - end end class BasicServlet < WEBrick::HTTPServlet::AbstractServlet def do_GET(req, res) - set_default_content_type(res, req.path) prevent_caching(res) + res['Content-Type'] = "text/plain" req.query.each do |k, v| res[k] = v unless k == 'responseBody' @@ -264,6 +255,15 @@ class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler set_default_content_type(res, req.path) prevent_caching(res) end + + def set_default_content_type(res, path) + res['Content-Type'] = case path + when /\.js$/ then 'text/javascript' + when /\.html$/ then 'text/html' + when /\.css$/ then 'text/css' + else 'text/plain' + end + end end class JavaScriptTestTask < ::Rake::TaskLib