@@ -15,7 +15,7 @@ public class Response
1515 {
1616 private readonly CDPSession _client ;
1717 private readonly bool _fromDiskCache ;
18- private string _buffer ;
18+ private byte [ ] _buffer ;
1919
2020 internal Response (
2121 CDPSession client ,
@@ -112,7 +112,7 @@ internal Response(
112112 /// Returns a Task which resolves to a buffer with response body
113113 /// </summary>
114114 /// <returns>A Task which resolves to a buffer with response body</returns>
115- public async ValueTask < string > BufferAsync ( )
115+ public async ValueTask < byte [ ] > BufferAsync ( )
116116 {
117117 if ( _buffer == null )
118118 {
@@ -125,9 +125,9 @@ public async ValueTask<string> BufferAsync()
125125 { MessageKeys . RequestId , Request . RequestId }
126126 } ) . ConfigureAwait ( false ) ;
127127
128- _buffer = response . Base64Encoded
129- ? Encoding . UTF8 . GetString ( Convert . FromBase64String ( response . Body ) )
130- : response . Body ;
128+ _buffer = response . Base64Encoded
129+ ? Convert . FromBase64String ( response . Body )
130+ : Encoding . UTF8 . GetBytes ( response . Body ) ;
131131 }
132132 catch ( Exception ex )
133133 {
@@ -142,7 +142,7 @@ public async ValueTask<string> BufferAsync()
142142 /// Returns a Task which resolves to a text representation of response body
143143 /// </summary>
144144 /// <returns>A Task which resolves to a text representation of response body</returns>
145- public ValueTask < string > TextAsync ( ) => BufferAsync ( ) ;
145+ public async ValueTask < string > TextAsync ( ) => Encoding . UTF8 . GetString ( await BufferAsync ( ) . ConfigureAwait ( false ) ) ;
146146
147147 /// <summary>
148148 /// Returns a Task which resolves to a <see cref="JObject"/> representation of response body
0 commit comments