Skip to content

Commit d92e71e

Browse files
authored
[dotnet] [bidi] Decouple AuthCredentials in Network module (#15491)
1 parent 43fcf45 commit d92e71e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dotnet/src/webdriver/BiDi/Modules/Network/AuthCredentials.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121

2222
namespace OpenQA.Selenium.BiDi.Modules.Network;
2323

24-
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
25-
[JsonDerivedType(typeof(Basic), "password")]
26-
public abstract record AuthCredentials
24+
public record AuthCredentials(string Username, string Password)
2725
{
28-
public record Basic(string Username, string Password) : AuthCredentials;
26+
[JsonInclude]
27+
internal string Type { get; } = "password";
2928
}
3029

3130

dotnet/test/common/BiDi/Network/NetworkTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public async Task CanContinueWithAuthCredentials()
163163
await using var intercept = await bidi.Network.InterceptAuthAsync(async e =>
164164
{
165165
//TODO Seems it would be better to have method which takes abstract options
166-
await e.Request.Request.ContinueWithAuthAsync(new AuthCredentials.Basic("test", "test"));
166+
await e.Request.Request.ContinueWithAuthAsync(new AuthCredentials("test", "test"));
167167
});
168168

169169
await context.NavigateAsync(UrlBuilder.WhereIs("basicAuth"), new() { Wait = ReadinessState.Complete });

0 commit comments

Comments
 (0)