lib/hanami/middleware.rb in hanami-0.7.3 vs lib/hanami/middleware.rb in hanami-0.8.0
- old
+ new
@@ -98,11 +98,11 @@
def load_default_stack(application)
@default_stack_loaded ||= begin
_load_assets_middleware
_load_session_middleware
_load_default_welcome_page_for(application)
- use Rack::MethodOverride
+ _load_method_override_middleware
true
end
end
@@ -132,12 +132,23 @@
# @api private
# @since 0.6.0
def _load_assets_middleware
env = Hanami.environment
- if !env.container? && env.serve_static_assets?
- require 'hanami/static'
- use Hanami::Static
+ if !env.container? && (middleware = env.static_assets_middleware)
+ use middleware
+ end
+ end
+
+ # Use MethodOverride middleware
+ #
+ # @api private
+ # @since 0.8.0
+ def _load_method_override_middleware
+ env = Hanami.environment
+
+ if !env.container?
+ use Rack::MethodOverride
end
end
end
end