lib/yard/server/commands/root_request_command.rb in yard-0.9.2 vs lib/yard/server/commands/root_request_command.rb in yard-0.9.3
- old
+ new
@@ -1,26 +1,13 @@
module YARD
module Server
module Commands
# Serves requests from the root of the server
class RootRequestCommand < Base
- def run
- favicon?
+ include StaticFileHelpers
- self.body = "Could not find: #{request.path}"
- self.status = 404
- end
-
- private
-
- # Return an empty favicon.ico if it does not exist so that
- # browsers don't complain.
- def favicon?
- return unless request.path == '/favicon.ico'
- self.headers['Content-Type'] = 'image/png'
- self.status = 200
- self.body = ''
- raise FinishRequest
+ def run
+ static_template_file? || favicon? || not_found
end
end
end
end
end