-  
 -   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
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...  |  
💥 What does this PR do?
This PR resolves a bug where optional, unspecified parameters were being sent as
nullin 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
.compactto remove any key-value pairs with anilvalue 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), thesenilvalues were present, and upon JSON serialization, they became JSONnullvalues.We called
.compacton the hash arguments to remove nil values:🔄 Types of changes