about summary refs log tree commit diff
path: root/lib/action_dispatch/cookie_jar_extensions.rb
diff options
context:
space:
mode:
authorJustin Tracey <j2tracey@gmail.com>2021-02-19 08:56:14 +0000
committerGitHub <noreply@github.com>2021-02-19 09:56:14 +0100
commitc9e8e1739c698291e1b034d19a1b01d75c9e039b (patch)
tree4d1aa255c0d76e2f518f611582dae2d09f84af02 /lib/action_dispatch/cookie_jar_extensions.rb
parentfc145de23865ebc957cde50f66844bcfad475e47 (diff)
replace all instances of "ends_with?" with "end_with?" (#15745)
The "ends_with?" method is just a Rails alias of Ruby's "end_with?" method.
Using the latter makes the code less brittle.
Diffstat (limited to 'lib/action_dispatch/cookie_jar_extensions.rb')
-rw-r--r--lib/action_dispatch/cookie_jar_extensions.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/action_dispatch/cookie_jar_extensions.rb b/lib/action_dispatch/cookie_jar_extensions.rb
index 492c04065..1be9053ba 100644
--- a/lib/action_dispatch/cookie_jar_extensions.rb
+++ b/lib/action_dispatch/cookie_jar_extensions.rb
@@ -7,7 +7,7 @@ module ActionDispatch
     # Monkey-patch ActionDispatch to serve secure cookies to Tor Hidden Service
     # users. Otherwise, ActionDispatch would drop the cookie over HTTP.
     def write_cookie?(*)
-      request.host.ends_with?('.onion') || super
+      request.host.end_with?('.onion') || super
     end
   end
 end
@@ -17,7 +17,7 @@ ActionDispatch::Cookies::CookieJar.prepend(ActionDispatch::CookieJarExtensions)
 module Rack
   module SessionPersistedExtensions
     def security_matches?(request, options)
-      request.host.ends_with?('.onion') || super
+      request.host.end_with?('.onion') || super
     end
   end
 end