prototype: jstest.rb cleanup.
This commit is contained in:
parent
c9a07576be
commit
a427d4a1b0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue