lib/grape/api.rb in grape-0.3.2 vs lib/grape/api.rb in grape-0.4.0

- old
+ new

@@ -354,21 +354,21 @@ def head(paths = ['/'], options = {}, &block); route('HEAD', paths, options, &block) end def delete(paths = ['/'], options = {}, &block); route('DELETE', paths, options, &block) end def options(paths = ['/'], options = {}, &block); route('OPTIONS', paths, options, &block) end def patch(paths = ['/'], options = {}, &block); route('PATCH', paths, options, &block) end - def namespace(space = nil, &block) + def namespace(space = nil, options = {}, &block) if space || block_given? previous_namespace_description = @namespace_description @namespace_description = (@namespace_description || {}).deep_merge(@last_description || {}) @last_description = nil nest(block) do - set(:namespace, space.to_s) if space + set(:namespace, Namespace.new(space, options)) if space end @namespace_description = previous_namespace_description else - Rack::Mount::Utils.normalize_path(settings.stack.map{|s| s[:namespace]}.join('/')) + Namespace.joined_space_path(settings) end end alias_method :group, :namespace alias_method :resource, :namespace @@ -505,10 +505,10 @@ }) end not_allowed_methods = %w(GET PUT POST DELETE PATCH HEAD) - methods not_allowed_methods << "OPTIONS" if self.class.settings[:do_not_route_options] not_allowed_methods.each do |bad_method| - @route_set.add_route( proc { [405, { 'Allow' => allow_header }, []]}, { + @route_set.add_route( proc { [405, { 'Allow' => allow_header, 'Content-Type' => 'text/plain' }, []]}, { :path_info => path_info, :request_method => bad_method }) end end