Skip to content

Commit

Permalink
Rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Dec 15, 2024
1 parent 715af5c commit 5e0787c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/hotwire_spark/action_cable/persistent_cable_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def supress_action_cable_restarts?(request)

def respond_suppressing_action_cable_restarts(env)
status, headers, body = suppressing_action_cable_restarts { @app.call(env) }
headers["Set-Cookie"] = append_cookie(headers["Set-Cookie"])
headers["Set-Cookie"] = append_cookie_to_disable_cable_restarts(headers["Set-Cookie"])

[ status, headers, body ]
end
Expand All @@ -32,11 +32,11 @@ def suppressing_action_cable_restarts(&block)
ActionCable.server.without_restarting(&block)
end

def append_cookie(existing_cookies)
[ existing_cookies, disable_action_cable_restarts_cookie ].compact
def append_cookie_to_disable_cable_restarts(existing_cookies)
[ existing_cookies, cookie_to_disable_cable_restarts ].compact
end

def disable_action_cable_restarts_cookie
def cookie_to_disable_cable_restarts
expiration = RESTARTS_SUPPRESSED_GRACE_PERIOD.from_now.utc
"#{COOKIE_NAME}=true; Path=/; Expires=#{expiration.httpdate}; HttpOnly"
end
Expand Down

0 comments on commit 5e0787c

Please sign in to comment.