diff --git a/dotnet/src/webdriver/DevTools/v130/V130Network.cs b/dotnet/src/webdriver/DevTools/v130/V130Network.cs index c76a972c84c49..8250ea6244de9 100644 --- a/dotnet/src/webdriver/DevTools/v130/V130Network.cs +++ b/dotnet/src/webdriver/DevTools/v130/V130Network.cs @@ -153,7 +153,7 @@ public override async Task ContinueRequest(HttpRequestData requestData) Url = requestData.Url, }; - if (requestData.Headers.Count > 0) + if (requestData.Headers?.Count > 0) { List headers = new List(); foreach (KeyValuePair headerPair in requestData.Headers) diff --git a/dotnet/src/webdriver/DevTools/v131/V131Network.cs b/dotnet/src/webdriver/DevTools/v131/V131Network.cs index a634125e6d021..48b99c4ba2034 100644 --- a/dotnet/src/webdriver/DevTools/v131/V131Network.cs +++ b/dotnet/src/webdriver/DevTools/v131/V131Network.cs @@ -153,7 +153,7 @@ public override async Task ContinueRequest(HttpRequestData requestData) Url = requestData.Url, }; - if (requestData.Headers.Count > 0) + if (requestData.Headers?.Count > 0) { List headers = new List(); foreach (KeyValuePair headerPair in requestData.Headers) diff --git a/dotnet/src/webdriver/DevTools/v132/V132Network.cs b/dotnet/src/webdriver/DevTools/v132/V132Network.cs index d5b66f4d4f58c..05b474be8364e 100644 --- a/dotnet/src/webdriver/DevTools/v132/V132Network.cs +++ b/dotnet/src/webdriver/DevTools/v132/V132Network.cs @@ -153,7 +153,7 @@ public override async Task ContinueRequest(HttpRequestData requestData) Url = requestData.Url, }; - if (requestData.Headers.Count > 0) + if (requestData.Headers?.Count > 0) { List headers = new List(); foreach (KeyValuePair headerPair in requestData.Headers) diff --git a/dotnet/src/webdriver/DevTools/v85/V85Network.cs b/dotnet/src/webdriver/DevTools/v85/V85Network.cs index 77e8174b8c720..8ca317383aa35 100644 --- a/dotnet/src/webdriver/DevTools/v85/V85Network.cs +++ b/dotnet/src/webdriver/DevTools/v85/V85Network.cs @@ -153,7 +153,7 @@ public override async Task ContinueRequest(HttpRequestData requestData) Url = requestData.Url, }; - if (requestData.Headers.Count > 0) + if (requestData.Headers?.Count > 0) { List headers = new List(); foreach (KeyValuePair headerPair in requestData.Headers) @@ -304,7 +304,7 @@ public override async Task AddResponseBody(HttpResponseData responseData) } /// - /// Asynchronously contines an intercepted network response without modification. + /// Asynchronously contiunes an intercepted network response without modification. /// /// The of the network response. /// A task that represents the asynchronous operation. diff --git a/dotnet/src/webdriver/HttpRequestData.cs b/dotnet/src/webdriver/HttpRequestData.cs index e1f0db6a86e81..72acf607f3f92 100644 --- a/dotnet/src/webdriver/HttpRequestData.cs +++ b/dotnet/src/webdriver/HttpRequestData.cs @@ -31,12 +31,11 @@ public class HttpRequestData /// /// Initializes a new instance of the type. /// - /// The method of the HTTP request. - /// The URL of the HTTP request. - /// The POST data of the HTTP request. - /// The headers of the HTTP request. - /// The ID of the HTTP request. - public HttpRequestData(string method, string url, string? postData, Dictionary headers, string requestId) + public HttpRequestData() + { + } + + internal HttpRequestData(string? method, string? url, string? postData, Dictionary? headers, string? requestId) { this.Method = method; this.Url = url; @@ -48,12 +47,12 @@ public HttpRequestData(string method, string url, string? postData, Dictionary /// Gets the method of the HTTP request. /// - public string Method { get; set; } + public string? Method { get; set; } /// /// Gets the URL of the HTTP request. /// - public string Url { get; set; } + public string? Url { get; set; } /// /// Gets the POST data of the HTTP request, if any. @@ -63,11 +62,11 @@ public HttpRequestData(string method, string url, string? postData, Dictionary /// Gets the headers of the HTTP request. /// - public Dictionary Headers { get; set; } + public Dictionary? Headers { get; set; } /// /// Gets the ID of the HTTP request. /// - public string RequestId { get; } + public string? RequestId { get; } } } diff --git a/dotnet/src/webdriver/NetworkRequestSentEventArgs.cs b/dotnet/src/webdriver/NetworkRequestSentEventArgs.cs index 33e43a04ff8b1..a88ba90b7cf7a 100644 --- a/dotnet/src/webdriver/NetworkRequestSentEventArgs.cs +++ b/dotnet/src/webdriver/NetworkRequestSentEventArgs.cs @@ -41,26 +41,29 @@ public NetworkRequestSentEventArgs(HttpRequestData requestData) this.RequestUrl = requestData.Url; this.RequestMethod = requestData.Method; this.RequestPostData = requestData.PostData; - foreach (KeyValuePair header in requestData.Headers) + if (requestData.Headers != null) { - this.requestHeaders[header.Key] = header.Value; + foreach (KeyValuePair header in requestData.Headers) + { + this.requestHeaders[header.Key] = header.Value; + } } } /// /// Gets the internal request ID of the network request. /// - public string RequestId { get; } + public string? RequestId { get; } /// /// Gets the URL of the network request. /// - public string RequestUrl { get; } + public string? RequestUrl { get; } /// /// Gets the HTTP method of the network request. /// - public string RequestMethod { get; } + public string? RequestMethod { get; } /// /// Gets the post data of the network request, if any.