[dotnet] [bidi] Support network SetExtraHeaders command by nvborisenko · Pull Request #16384 · SeleniumHQ/selenium
Conversation
User description
https://w3c.github.io/webdriver-bidi/#command-network-setExtraHeaders
💥 What does this PR do?
Implements SetExtraHeaders command in Network module.
💡 Additional Considerations
Test is ignored, but I verified locally for Chrome Dev channel.
🔄 Types of changes
- New feature (non-breaking change which adds functionality and tests!)
PR Type
Enhancement
Description
-
Add
SetExtraHeaderscommand to Network module -
Implement BiDi network header manipulation functionality
-
Include command parameters and options classes
-
Add test coverage with browser compatibility notes
Diagram Walkthrough
flowchart LR
A["NetworkModule"] --> B["SetExtraHeadersAsync method"]
B --> C["SetExtraHeadersCommand"]
C --> D["SetExtraHeadersParameters"]
E["BiDiJsonSerializerContext"] --> C
F["NetworkTest"] --> B
File Walkthrough
| Relevant files | |||||
|---|---|---|---|---|---|
| Configuration changes |
| ||||
| Enhancement |
| ||||
| Tests |
|
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
| Security Compliance | |
| 🟢 | No security concerns identifiedNo security vulnerabilities detected by AI analysis. Human verification advised for critical code. |
| Ticket Compliance | |
| ⚪ | 🎫 No ticket provided
|
| Codebase Duplication Compliance | |
| ⚪ | Codebase context is not definedFollow the guide to enable codebase context checks. |
| Custom Compliance | |
| ⚪ | No custom compliance providedFollow the guide to enable custom compliance check. |
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| General |
Fix incorrect test assertion logicIn the dotnet/test/common/BiDi/Network/NetworkTest.cs [259-264] -public async Task CanSetExtraHeaders() +public void CanSetExtraHeaders() { - var result = await bidi.Network.SetExtraHeadersAsync([new Header("x-test-header", "test-value")]); - - Assert.That(result, Is.Not.Null); + Assert.That(async () => await bidi.Network.SetExtraHeadersAsync([new Header("x-test-header", "test-value")]), Throws.Nothing); }
Suggestion importance[1-10]: 8__ Why: The suggestion correctly points out that asserting a struct is not null is a meaningless test. It proposes a much better assertion ( | Medium |
| Possible issue |
Add null check for headersAdd a null check for the dotnet/src/webdriver/BiDi/Network/NetworkModule.cs [68-73] public async Task<EmptyResult> SetExtraHeadersAsync(IEnumerable<Header> headers, SetExtraHeadersOptions? options = null)
{
+ if (headers is null)
+ {
+ throw new ArgumentNullException(nameof(headers));
+ }
+
var @params = new SetExtraHeadersParameters(headers, options?.Contexts, options?.UserContexts);
return await Broker.ExecuteCommandAsync<SetExtraHeadersCommand, EmptyResult>(new SetExtraHeadersCommand(@params), options).ConfigureAwait(false);
}
Suggestion importance[1-10]: 7__ Why: The suggestion correctly identifies a missing null check for the | Medium |
| ||
This was referenced
Oct 19, 2025This was referenced
Dec 15, 2025This was referenced
Jan 19, 2026This was referenced
Feb 11, 2026This was referenced
Feb 20, 2026This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters