Class: NonCachingFileHandler
- Inherits:
-
WEBrick::HTTPServlet::FileHandler
- Object
- WEBrick::HTTPServlet::FileHandler
- NonCachingFileHandler
- Defined in:
- lib/newjs/jstest.rb
Instance Method Summary collapse
Instance Method Details
#do_GET(req, res) ⇒ Object
253 254 255 256 257 |
# File 'lib/newjs/jstest.rb', line 253 def do_GET(req, res) super set_default_content_type(res, req.path) prevent_caching(res) end |
#set_default_content_type(res, path) ⇒ Object
259 260 261 262 263 264 265 266 |
# File 'lib/newjs/jstest.rb', line 259 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 |