-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rb] handled nil condition for Cookie Method in ruby #15099
base: trunk
Are you sure you want to change the base?
[rb] handled nil condition for Cookie Method in ruby #15099
Conversation
PR Reviewer Guide 🔍(Review updated until commit 10cc4d3)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 10cc4d3
Previous suggestions✅ Suggestions up to commit 3966bfe
|
Thank you so much for the help! this is already implemented, so I will close the PR, have a great day! |
@aguspe This adds validation of cookie name to be aligned with other bindings, I think the PR is still actual. |
@nvborisenko I was talking with Pallavi, and It feels strange for me to add this type of validation in Ruby with a mandatory parameter. But if the goal is to be aligned between all the bindings and return a consistent error across bindings and browsers then I can re-open this and help Pallavi with the testing We can update the guard clause instead to make it more Ruby-like |
After discussing with @nvborisenko I'm re-opening this PR and adding a review comment |
@@ -385,10 +385,16 @@ def add_cookie(cookie) | |||
end | |||
|
|||
def delete_cookie(name) | |||
if ( name.nil? || name.empty?) then | |||
raise Error::ArgumentError, 'Cookie name cannot be null or empty' | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use a guard clause here such as:
raise Error::ArgumentError, 'Cookie name cannot be null or empty' unless name && !name.empty?
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
implemented handling nil/empty for cookie methods - reference pr- #15044
Motivation and Context
it wasn't implemented in ruby
Types of changes
Checklist
implemented handling nil/empty for cookie methods - reference pr- #15044
PR Type
Bug fix, Enhancement
Description
Added validation for
nil
or empty cookie names indelete_cookie
andcookie
methods.Raised
Error::ArgumentError
for invalid cookie names.Improved error handling for cookie-related methods in Ruby WebDriver.
Changes walkthrough 📝
bridge.rb
Validate cookie name in Ruby WebDriver methods
rb/lib/selenium/webdriver/remote/bridge.rb
nil
or empty cookie names indelete_cookie
andcookie
methods.
Error::ArgumentError
with a descriptive message for invalidnames.