Skip to content

Commit b83facd

Browse files
committed
Do not consume our public-facing HTTP request event args body
1 parent 6eb1d89 commit b83facd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

dotnet/src/webdriver/Remote/HttpCommandExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ private async Task<HttpResponseInfo> MakeHttpRequest(HttpRequestInfo requestInfo
280280
acceptHeader.CharSet = Utf8CharsetType;
281281
requestMessage.Headers.Accept.Add(acceptHeader);
282282

283-
byte[] bytes = Encoding.UTF8.GetBytes(eventArgs.RequestBody);
283+
byte[] bytes = Encoding.UTF8.GetBytes(requestInfo.RequestBody);
284284
requestMessage.Content = new ByteArrayContent(bytes, 0, bytes.Length);
285285

286286
MediaTypeHeaderValue contentTypeHeader = new MediaTypeHeaderValue(JsonMimeType);

dotnet/src/webdriver/Remote/SendingRemoteHttpRequestEventArgs.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public class SendingRemoteHttpRequestEventArgs : EventArgs
3737
/// <param name="method">The HTTP method of the request being sent.</param>
3838
/// <param name="fullUrl">The full URL of the request being sent.</param>
3939
/// <param name="requestBody">The body of the request.</param>
40-
/// <exception cref="ArgumentNullException">If <paramref name="method"/>, <paramref name="fullUrl"/>, or <paramref name="requestBody"/> are null.</exception>
41-
public SendingRemoteHttpRequestEventArgs(string method, string fullUrl, string requestBody)
40+
/// <exception cref="ArgumentNullException">If <paramref name="method"/>, <paramref name="fullUrl"/> are null.</exception>
41+
public SendingRemoteHttpRequestEventArgs(string method, string fullUrl, string? requestBody)
4242
{
4343
this.Method = method ?? throw new ArgumentNullException(nameof(method));
4444
this.FullUrl = fullUrl ?? throw new ArgumentNullException(nameof(fullUrl));
45-
this.RequestBody = requestBody ?? throw new ArgumentNullException(nameof(requestBody));
45+
this.RequestBody = requestBody;
4646
}
4747

4848
/// <summary>
@@ -58,7 +58,7 @@ public SendingRemoteHttpRequestEventArgs(string method, string fullUrl, string r
5858
/// <summary>
5959
/// Gets the body of the HTTP request as a string.
6060
/// </summary>
61-
public string RequestBody { get; }
61+
public string? RequestBody { get; }
6262

6363
/// <summary>
6464
/// Gets a read-only dictionary of the headers of the HTTP request.

0 commit comments

Comments
 (0)