Class: Fronde::Preview::Servlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Fronde::Preview::Servlet
- Includes:
- WEBrick::HTTPUtils
- Defined in:
- lib/fronde/preview.rb
Overview
A tiny preview server, which main goal is to replace references to
the target domain by localhost.
Instance Method Summary collapse
-
#do_GET(request, response) ⇒ Object
rubocop:disable Naming/MethodName.
Instance Method Details
#do_GET(request, response) ⇒ Object
rubocop:disable Naming/MethodName
13 14 15 16 17 18 |
# File 'lib/fronde/preview.rb', line 13 def do_GET(request, response) # rubocop:disable Naming/MethodName file = local_path(request.path) response.body = parse_body(file, "http://#{request.host}:#{request.port}") response.status = 200 response.content_type = mime_type(file, DefaultMimeTypes) end |