Skip to content

Commit 2209807

Browse files
committed
Delegate each_response_cookies to cookies
Fix rubocop Add CHANGELOG
1 parent 9931f9a commit 2209807

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* [#2537](https://github.com/ruby-grape/grape/pull/2537): Use activesupport `try` pattern - [@ericproulx](https://github.com/ericproulx).
88
* [#2536](https://github.com/ruby-grape/grape/pull/2536): Update normalize_path like Rails - [@ericproulx](https://github.com/ericproulx).
99
* [#2540](https://github.com/ruby-grape/grape/pull/2540): Introduce Params builder with symbolized short name - [@ericproulx](https://github.com/ericproulx).
10+
* [#2549](https://github.com/ruby-grape/grape/pull/2549): Delegate cookies management to Grape::Request - [@ericproulx](https://github.com/ericproulx).
1011
* Your contribution here.
1112

1213
#### Fixes

lib/grape/endpoint.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class Endpoint
1313
attr_accessor :block, :source, :options
1414
attr_reader :env, :request
1515

16-
def_delegators :request, :params, :headers, :cookies
16+
def_delegators :request, :params, :headers
17+
def_delegators :cookies, :each_response_cookies
1718

1819
class << self
1920
def new(...)
@@ -329,7 +330,7 @@ def run_filters(filters, type = :other)
329330
extend post_extension if post_extension
330331
end
331332

332-
%i(befores before_validations after_validations afters finallies).each do |method|
333+
%i[befores before_validations after_validations afters finallies].each do |method|
333334
define_method method do
334335
namespace_stackable(method)
335336
end
@@ -402,7 +403,7 @@ def build_helpers
402403
end
403404

404405
def build_response_cookies
405-
cookies.each_response_cookies do |name, value|
406+
each_response_cookies do |name, value|
406407
cookie_value = value.is_a?(Hash) ? value : { value: value }
407408
Rack::Utils.set_cookie_header! header, name, cookie_value
408409
end

0 commit comments

Comments
 (0)