mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #17792 from rockrep/master
allow 'all' for :domain option in addition to :all
This commit is contained in:
commit
dfa45ce7e1
2 changed files with 11 additions and 1 deletions
|
@ -283,7 +283,7 @@ module ActionDispatch
|
|||
def handle_options(options) #:nodoc:
|
||||
options[:path] ||= "/"
|
||||
|
||||
if options[:domain] == :all
|
||||
if options[:domain].respond_to?(:to_sym) && options[:domain].to_sym == :all
|
||||
# if there is a provided tld length then we use it otherwise default domain regexp
|
||||
domain_regexp = options[:tld_length] ? /([^.]+\.?){#{options[:tld_length]}}$/ : DOMAIN_REGEXP
|
||||
|
||||
|
|
|
@ -145,11 +145,21 @@ class CookiesTest < ActionController::TestCase
|
|||
head :ok
|
||||
end
|
||||
|
||||
def set_cookie_with_domain_all_as_string
|
||||
cookies[:user_name] = {:value => "rizwanreza", :domain => 'all'}
|
||||
head :ok
|
||||
end
|
||||
|
||||
def delete_cookie_with_domain
|
||||
cookies.delete(:user_name, :domain => :all)
|
||||
head :ok
|
||||
end
|
||||
|
||||
def delete_cookie_with_domain_all_as_string
|
||||
cookies.delete(:user_name, :domain => 'all')
|
||||
head :ok
|
||||
end
|
||||
|
||||
def set_cookie_with_domain_and_tld
|
||||
cookies[:user_name] = {:value => "rizwanreza", :domain => :all, :tld_length => 2}
|
||||
head :ok
|
||||
|
|
Loading…
Reference in a new issue