prototype: jstest.rb cleanup.

This commit is contained in:
Tobie Langel 2007-12-30 11:16:15 +00:00
parent c9a07576be
commit a427d4a1b0

View File

@ -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