Skip to content

Commit b700588

Browse files
committed
Network
1 parent a901f4c commit b700588

11 files changed

+57
-31
lines changed

dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,25 @@ namespace OpenQA.Selenium.BiDi.Communication.Json;
137137
[JsonSerializable(typeof(Network.AddInterceptCommand))]
138138
[JsonSerializable(typeof(Network.AddInterceptResult))]
139139
[JsonSerializable(typeof(Network.ContinueRequestCommand))]
140+
[JsonSerializable(typeof(Network.ContinueRequestResult))]
140141
[JsonSerializable(typeof(Network.ContinueResponseCommand))]
142+
[JsonSerializable(typeof(Network.ContinueResponseResult))]
141143
[JsonSerializable(typeof(Network.ContinueWithAuthCommand))]
144+
[JsonSerializable(typeof(Network.ContinueWithAuthResult))]
142145
[JsonSerializable(typeof(Network.FailRequestCommand))]
146+
[JsonSerializable(typeof(Network.FailRequestResult))]
143147
[JsonSerializable(typeof(Network.GetDataCommand))]
144148
[JsonSerializable(typeof(Network.GetDataResult))]
145149
[JsonSerializable(typeof(Network.ProvideResponseCommand))]
150+
[JsonSerializable(typeof(Network.ProvideResponseResult))]
146151
[JsonSerializable(typeof(Network.RemoveDataCollectorCommand))]
152+
[JsonSerializable(typeof(Network.RemoveDataCollectorResult))]
147153
[JsonSerializable(typeof(Network.RemoveInterceptCommand))]
154+
[JsonSerializable(typeof(Network.RemoveInterceptResult))]
148155
[JsonSerializable(typeof(Network.SetCacheBehaviorCommand))]
156+
[JsonSerializable(typeof(Network.SetCacheBehaviorResult))]
149157
[JsonSerializable(typeof(Network.SetExtraHeadersCommand))]
158+
[JsonSerializable(typeof(Network.SetExtraHeadersResult))]
150159

151160
[JsonSerializable(typeof(Network.BeforeRequestSentEventArgs))]
152161
[JsonSerializable(typeof(Network.ResponseStartedEventArgs))]

dotnet/src/webdriver/BiDi/Network/ContinueRequestCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace OpenQA.Selenium.BiDi.Network;
2424

2525
internal sealed class ContinueRequestCommand(ContinueRequestParameters @params)
26-
: Command<ContinueRequestParameters, EmptyResult>(@params, "network.continueRequest");
26+
: Command<ContinueRequestParameters, ContinueRequestResult>(@params, "network.continueRequest");
2727

2828
internal sealed record ContinueRequestParameters(Request Request, BytesValue? Body, IEnumerable<CookieHeader>? Cookies, IEnumerable<Header>? Headers, string? Method, string? Url) : Parameters;
2929

@@ -39,3 +39,5 @@ public sealed class ContinueRequestOptions : CommandOptions
3939

4040
public string? Url { get; set; }
4141
}
42+
43+
public sealed record ContinueRequestResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/ContinueResponseCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace OpenQA.Selenium.BiDi.Network;
2424

2525
internal sealed class ContinueResponseCommand(ContinueResponseParameters @params)
26-
: Command<ContinueResponseParameters, EmptyResult>(@params, "network.continueResponse");
26+
: Command<ContinueResponseParameters, ContinueResponseResult>(@params, "network.continueResponse");
2727

2828
internal sealed record ContinueResponseParameters(Request Request, IEnumerable<SetCookieHeader>? Cookies, IEnumerable<AuthCredentials>? Credentials, IEnumerable<Header>? Headers, string? ReasonPhrase, long? StatusCode) : Parameters;
2929

@@ -39,3 +39,5 @@ public sealed class ContinueResponseOptions : CommandOptions
3939

4040
public long? StatusCode { get; set; }
4141
}
42+
43+
public sealed record ContinueResponseResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/ContinueWithAuthCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace OpenQA.Selenium.BiDi.Network;
2424

2525
internal class ContinueWithAuthCommand(ContinueWithAuthParameters @params)
26-
: Command<ContinueWithAuthParameters, EmptyResult>(@params, "network.continueWithAuth");
26+
: Command<ContinueWithAuthParameters, ContinueWithAuthResult>(@params, "network.continueWithAuth");
2727

2828
[JsonPolymorphic(TypeDiscriminatorPropertyName = "action")]
2929
[JsonDerivedType(typeof(ContinueWithAuthCredentials), "provideCredentials")]
@@ -49,3 +49,4 @@ public sealed class ContinueWithAuthDefaultCredentialsOptions : ContinueWithAuth
4949

5050
public sealed class ContinueWithAuthCancelCredentialsOptions : ContinueWithAuthNoCredentialsOptions;
5151

52+
public sealed record ContinueWithAuthResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/FailRequestCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
namespace OpenQA.Selenium.BiDi.Network;
2323

2424
internal sealed class FailRequestCommand(FailRequestParameters @params)
25-
: Command<FailRequestParameters, EmptyResult>(@params, "network.failRequest");
25+
: Command<FailRequestParameters, FailRequestResult>(@params, "network.failRequest");
2626

2727
internal sealed record FailRequestParameters(Request Request) : Parameters;
2828

2929
public sealed class FailRequestOptions : CommandOptions;
30+
31+
public sealed record FailRequestResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/NetworkModule.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,53 @@ public async Task<Intercept> AddInterceptAsync(IEnumerable<InterceptPhase> phase
4444
return result.Intercept;
4545
}
4646

47-
public async Task<EmptyResult> RemoveDataCollectorAsync(Collector collector, RemoveDataCollectorOptions? options = null)
47+
public async Task<RemoveDataCollectorResult> RemoveDataCollectorAsync(Collector collector, RemoveDataCollectorOptions? options = null)
4848
{
4949
var @params = new RemoveDataCollectorParameters(collector);
5050

51-
return await Broker.ExecuteCommandAsync(new RemoveDataCollectorCommand(@params), options, JsonContext.RemoveDataCollectorCommand, JsonContext.EmptyResult).ConfigureAwait(false);
51+
return await Broker.ExecuteCommandAsync(new RemoveDataCollectorCommand(@params), options, JsonContext.RemoveDataCollectorCommand, JsonContext.RemoveDataCollectorResult).ConfigureAwait(false);
5252
}
5353

54-
public async Task<EmptyResult> RemoveInterceptAsync(Intercept intercept, RemoveInterceptOptions? options = null)
54+
public async Task<RemoveInterceptResult> RemoveInterceptAsync(Intercept intercept, RemoveInterceptOptions? options = null)
5555
{
5656
var @params = new RemoveInterceptParameters(intercept);
5757

58-
return await Broker.ExecuteCommandAsync(new RemoveInterceptCommand(@params), options, JsonContext.RemoveInterceptCommand, JsonContext.EmptyResult).ConfigureAwait(false);
58+
return await Broker.ExecuteCommandAsync(new RemoveInterceptCommand(@params), options, JsonContext.RemoveInterceptCommand, JsonContext.RemoveInterceptResult).ConfigureAwait(false);
5959
}
6060

61-
public async Task<EmptyResult> SetCacheBehaviorAsync(CacheBehavior behavior, SetCacheBehaviorOptions? options = null)
61+
public async Task<SetCacheBehaviorResult> SetCacheBehaviorAsync(CacheBehavior behavior, SetCacheBehaviorOptions? options = null)
6262
{
6363
var @params = new SetCacheBehaviorParameters(behavior, options?.Contexts);
6464

65-
return await Broker.ExecuteCommandAsync(new SetCacheBehaviorCommand(@params), options, JsonContext.SetCacheBehaviorCommand, JsonContext.EmptyResult).ConfigureAwait(false);
65+
return await Broker.ExecuteCommandAsync(new SetCacheBehaviorCommand(@params), options, JsonContext.SetCacheBehaviorCommand, JsonContext.SetCacheBehaviorResult).ConfigureAwait(false);
6666
}
6767

68-
public async Task<EmptyResult> SetExtraHeadersAsync(IEnumerable<Header> headers, SetExtraHeadersOptions? options = null)
68+
public async Task<SetExtraHeadersResult> SetExtraHeadersAsync(IEnumerable<Header> headers, SetExtraHeadersOptions? options = null)
6969
{
7070
var @params = new SetExtraHeadersParameters(headers, options?.Contexts, options?.UserContexts);
7171

72-
return await Broker.ExecuteCommandAsync(new SetExtraHeadersCommand(@params), options, JsonContext.SetExtraHeadersCommand, JsonContext.EmptyResult).ConfigureAwait(false);
72+
return await Broker.ExecuteCommandAsync(new SetExtraHeadersCommand(@params), options, JsonContext.SetExtraHeadersCommand, JsonContext.SetExtraHeadersResult).ConfigureAwait(false);
7373
}
7474

75-
public async Task<EmptyResult> ContinueRequestAsync(Request request, ContinueRequestOptions? options = null)
75+
public async Task<ContinueRequestResult> ContinueRequestAsync(Request request, ContinueRequestOptions? options = null)
7676
{
7777
var @params = new ContinueRequestParameters(request, options?.Body, options?.Cookies, options?.Headers, options?.Method, options?.Url);
7878

79-
return await Broker.ExecuteCommandAsync(new ContinueRequestCommand(@params), options, JsonContext.ContinueRequestCommand, JsonContext.EmptyResult).ConfigureAwait(false);
79+
return await Broker.ExecuteCommandAsync(new ContinueRequestCommand(@params), options, JsonContext.ContinueRequestCommand, JsonContext.ContinueRequestResult).ConfigureAwait(false);
8080
}
8181

82-
public async Task<EmptyResult> ContinueResponseAsync(Request request, ContinueResponseOptions? options = null)
82+
public async Task<ContinueResponseResult> ContinueResponseAsync(Request request, ContinueResponseOptions? options = null)
8383
{
8484
var @params = new ContinueResponseParameters(request, options?.Cookies, options?.Credentials, options?.Headers, options?.ReasonPhrase, options?.StatusCode);
8585

86-
return await Broker.ExecuteCommandAsync(new ContinueResponseCommand(@params), options, JsonContext.ContinueResponseCommand, JsonContext.EmptyResult).ConfigureAwait(false);
86+
return await Broker.ExecuteCommandAsync(new ContinueResponseCommand(@params), options, JsonContext.ContinueResponseCommand, JsonContext.ContinueResponseResult).ConfigureAwait(false);
8787
}
8888

89-
public async Task<EmptyResult> FailRequestAsync(Request request, FailRequestOptions? options = null)
89+
public async Task<FailRequestResult> FailRequestAsync(Request request, FailRequestOptions? options = null)
9090
{
9191
var @params = new FailRequestParameters(request);
9292

93-
return await Broker.ExecuteCommandAsync(new FailRequestCommand(@params), options, JsonContext.FailRequestCommand, JsonContext.EmptyResult).ConfigureAwait(false);
93+
return await Broker.ExecuteCommandAsync(new FailRequestCommand(@params), options, JsonContext.FailRequestCommand, JsonContext.FailRequestResult).ConfigureAwait(false);
9494
}
9595

9696
public async Task<BytesValue> GetDataAsync(DataType dataType, Request request, GetDataOptions? options = null)
@@ -102,26 +102,26 @@ public async Task<BytesValue> GetDataAsync(DataType dataType, Request request, G
102102
return result.Bytes;
103103
}
104104

105-
public async Task<EmptyResult> ProvideResponseAsync(Request request, ProvideResponseOptions? options = null)
105+
public async Task<ProvideResponseResult> ProvideResponseAsync(Request request, ProvideResponseOptions? options = null)
106106
{
107107
var @params = new ProvideResponseParameters(request, options?.Body, options?.Cookies, options?.Headers, options?.ReasonPhrase, options?.StatusCode);
108108

109-
return await Broker.ExecuteCommandAsync(new ProvideResponseCommand(@params), options, JsonContext.ProvideResponseCommand, JsonContext.EmptyResult).ConfigureAwait(false);
109+
return await Broker.ExecuteCommandAsync(new ProvideResponseCommand(@params), options, JsonContext.ProvideResponseCommand, JsonContext.ProvideResponseResult).ConfigureAwait(false);
110110
}
111111

112-
public async Task<EmptyResult> ContinueWithAuthAsync(Request request, AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null)
112+
public async Task<ContinueWithAuthResult> ContinueWithAuthAsync(Request request, AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null)
113113
{
114-
return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCredentials(request, credentials)), options, JsonContext.ContinueWithAuthCommand, JsonContext.EmptyResult).ConfigureAwait(false);
114+
return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCredentials(request, credentials)), options, JsonContext.ContinueWithAuthCommand, JsonContext.ContinueWithAuthResult).ConfigureAwait(false);
115115
}
116116

117-
public async Task<EmptyResult> ContinueWithAuthAsync(Request request, ContinueWithAuthDefaultCredentialsOptions? options = null)
117+
public async Task<ContinueWithAuthResult> ContinueWithAuthAsync(Request request, ContinueWithAuthDefaultCredentialsOptions? options = null)
118118
{
119-
return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthDefaultCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.EmptyResult).ConfigureAwait(false);
119+
return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthDefaultCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.ContinueWithAuthResult).ConfigureAwait(false);
120120
}
121121

122-
public async Task<EmptyResult> ContinueWithAuthAsync(Request request, ContinueWithAuthCancelCredentialsOptions? options = null)
122+
public async Task<ContinueWithAuthResult> ContinueWithAuthAsync(Request request, ContinueWithAuthCancelCredentialsOptions? options = null)
123123
{
124-
return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCancelCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.EmptyResult).ConfigureAwait(false);
124+
return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCancelCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.ContinueWithAuthResult).ConfigureAwait(false);
125125
}
126126

127127
public async Task<Subscription> OnBeforeRequestSentAsync(Func<BeforeRequestSentEventArgs, Task> handler, SubscriptionOptions? options = null)

dotnet/src/webdriver/BiDi/Network/ProvideResponseCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace OpenQA.Selenium.BiDi.Network;
2424

2525
internal sealed class ProvideResponseCommand(ProvideResponseParameters @params)
26-
: Command<ProvideResponseParameters, EmptyResult>(@params, "network.provideResponse");
26+
: Command<ProvideResponseParameters, ProvideResponseResult>(@params, "network.provideResponse");
2727

2828
internal sealed record ProvideResponseParameters(Request Request, BytesValue? Body, IEnumerable<SetCookieHeader>? Cookies, IEnumerable<Header>? Headers, string? ReasonPhrase, long? StatusCode) : Parameters;
2929

@@ -39,3 +39,5 @@ public sealed class ProvideResponseOptions : CommandOptions
3939

4040
public long? StatusCode { get; set; }
4141
}
42+
43+
public sealed record ProvideResponseResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/RemoveDataCollectorCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
namespace OpenQA.Selenium.BiDi.Network;
2323

2424
internal sealed class RemoveDataCollectorCommand(RemoveDataCollectorParameters @params)
25-
: Command<RemoveDataCollectorParameters, EmptyResult>(@params, "network.removeDataCollector");
25+
: Command<RemoveDataCollectorParameters, RemoveDataCollectorResult>(@params, "network.removeDataCollector");
2626

2727
internal sealed record RemoveDataCollectorParameters(Collector Collector) : Parameters;
2828

2929
public class RemoveDataCollectorOptions : CommandOptions;
30+
31+
public sealed record RemoveDataCollectorResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/RemoveInterceptCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
namespace OpenQA.Selenium.BiDi.Network;
2323

2424
internal sealed class RemoveInterceptCommand(RemoveInterceptParameters @params)
25-
: Command<RemoveInterceptParameters, EmptyResult>(@params, "network.removeIntercept");
25+
: Command<RemoveInterceptParameters, RemoveInterceptResult>(@params, "network.removeIntercept");
2626

2727
internal sealed record RemoveInterceptParameters(Intercept Intercept) : Parameters;
2828

2929
public class RemoveInterceptOptions : CommandOptions;
30+
31+
public sealed record RemoveInterceptResult : EmptyResult;

dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
namespace OpenQA.Selenium.BiDi.Network;
2626

2727
internal sealed class SetCacheBehaviorCommand(SetCacheBehaviorParameters @params)
28-
: Command<SetCacheBehaviorParameters, EmptyResult>(@params, "network.setCacheBehavior");
28+
: Command<SetCacheBehaviorParameters, SetCacheBehaviorResult>(@params, "network.setCacheBehavior");
2929

3030
internal sealed record SetCacheBehaviorParameters(CacheBehavior CacheBehavior, IEnumerable<BrowsingContext.BrowsingContext>? Contexts) : Parameters;
3131

@@ -52,3 +52,5 @@ public enum CacheBehavior
5252
Default,
5353
Bypass
5454
}
55+
56+
public sealed record SetCacheBehaviorResult : EmptyResult;

0 commit comments

Comments
 (0)