-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rb] Fix Network issue by removing nil values on network requests #16442
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
base: trunk
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
PR Code Suggestions ✨Explore these optional code suggestions:
|
A few tests are consistently failing. Could you please have a look, @aguspe? |
well, I don't think that's what I wanted to do. It doesn't want me to push from command line, so I tried to edit on Github, don't think it did what I wanted it to do... |
I accidentally copied the integration tests onto the unit tests. |
💥 What does this PR do?
This PR resolves a bug where optional, unspecified parameters were being sent as
null
in the JSON payload for network modification commands (network.continueRequest
,network.continueResponse
,network.provideResponse
).This was causing errors, particularly with the Firefox BiDi implementation, which expects optional fields to be nil.
The fix uses the Ruby method
.compact
to remove any key-value pairs with anil
value from the command arguments hash before serialization.🔧 Implementation Notes
The core of the issue was that parameters like
cookies
,headers
, orbody
, when left unprovided by the user, defaulted tonil
.When constructing the command hash (e.g., in
#continue_request
), thesenil
values were present, and upon JSON serialization, they became JSONnull
values.We called
.compact
on the hash arguments to remove nil values:🔄 Types of changes