Skip to content

Commit 2118f4a

Browse files
committed
[rb] fix bug with http_only cookies
1 parent 41a22c0 commit 2118f4a

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

rb/lib/selenium/webdriver/common/manager.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def add_cookie(opts = {})
5252
same_site = opts.delete(:same_site)
5353
opts[:sameSite] = same_site if same_site
5454

55+
http_only = opts.delete(:http_only)
56+
opts[:httpOnly] = http_only if http_only
57+
5558
obj = opts.delete(:expires)
5659
opts[:expiry] = seconds_from(obj).to_i if obj
5760

rb/spec/integration/selenium/webdriver/manager_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ module WebDriver
5555
describe 'cookie management' do
5656
after { driver.manage.delete_all_cookies }
5757

58+
it 'should show http only when insecure' do
59+
driver.navigate.to url_for('xhtmlTest.html')
60+
driver.manage.add_cookie name: 'security',
61+
value: 'insecure',
62+
http_only: true
63+
64+
expect(driver.manage.cookie_named('security')[:http_only]).to eq true
65+
end
66+
5867
it 'should not show secure when insecure' do
5968
driver.navigate.to url_for('xhtmlTest.html')
6069
driver.manage.add_cookie name: 'security',

0 commit comments

Comments
 (0)