Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [#2667](https://github.com/ruby-grape/grape/pull/2667): Skip instrumentation in run_validators when no validators present - [@ericproulx](https://github.com/ericproulx).
* [#2670](https://github.com/ruby-grape/grape/pull/2670): Added support for Rack 3.2.6 and better handling to rack exceptions - [@ericproulx](https://github.com/ericproulx).
* [#2671](https://github.com/ruby-grape/grape/pull/2671): Use ruby 3.1 shorthand kwargs syntax - [@ericproulx](https://github.com/ericproulx).
* [#2672](https://github.com/ruby-grape/grape/pull/2672): Minor ruby optimizations - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

#### Fixes
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/dsl/parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def optional(*attrs, **opts, &block)
# @param (see #requires)
# @option (see #requires)
def with(**opts, &)
new_group_attrs = [@group, opts].compact.reduce(&:deep_merge)
new_group_attrs = @group&.deep_merge(opts) || opts
new_group_scope(new_group_attrs, &)
end

Expand Down
6 changes: 4 additions & 2 deletions lib/grape/router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def recognize_path(input)
any.endpoint
end

DEFAULT_RESPONSE_HEADERS = Grape::Util::Header.new.merge('X-Cascade' => 'pass').freeze
DEFAULT_RESPONSE_BODY = ['404 Not Found'].freeze

private

def identity(input, method, env)
Expand Down Expand Up @@ -146,8 +149,7 @@ def with_optimization
end

def default_response
headers = Grape::Util::Header.new.merge('X-Cascade' => 'pass')
[404, headers, ['404 Not Found']]
[404, DEFAULT_RESPONSE_HEADERS.dup, DEFAULT_RESPONSE_BODY.dup]
end

def match?(input, method)
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/util/inheritable_setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def inherit_from(parent)
namespace_reverse_stackable.inherited_values = parent.namespace_reverse_stackable
self.route = parent.route.merge(route)

point_in_time_copies.map { |cloned_one| cloned_one.inherit_from parent }
point_in_time_copies.each { |cloned_one| cloned_one.inherit_from parent }
end

# Create a point-in-time copy of this settings instance, with clones of
Expand Down
Loading