Skip to content

Commit 55f69d5

Browse files
committed
Improve comment in StringConverter
1 parent 4d11714 commit 55f69d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dotnet/src/webdriver/DevTools/Json/StringConverter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ internal sealed class StringConverter : JsonConverter<string>
1919
}
2020
catch (InvalidOperationException)
2121
{
22-
// CDP sometimes sends invalid surrogate pairs on file upload
22+
// Fallback to read the value as bytes instead of string.
23+
// System.Text.Json library throws exception when CDP remote end sends non-encoded string as binary data.
24+
// Using JavaScriptEncoder.UnsafeRelaxedJsonEscaping doesn't help because the string actually is byte[].
25+
// https://chromedevtools.github.io/devtools-protocol/tot/Network/#type-Request - here "postData" property
26+
// is a string, which we cannot deserialize properly. This property is marked as deprecated, and new "postDataEntries"
27+
// is suggested for using, where most likely it is base64 encoded.
2328

2429
var bytes = reader.ValueSpan;
2530
var sb = new StringBuilder(bytes.Length);

0 commit comments

Comments
 (0)