File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -86,15 +86,21 @@ public ApiResponseContext(ApiRequestContext context)
8686 var options = this . HttpContext . HttpApiOptions . JsonDeserializeOptions ;
8787 var serializer = this . HttpContext . ServiceProvider . GetJsonSerializer ( ) ;
8888
89- if ( Encoding . UTF8 . Equals ( encoding ) == true )
89+ if ( Encoding . UTF8 . Equals ( encoding ) == false )
90+ {
91+ var byteArray = await content . ReadAsByteArrayAsync ( ) . ConfigureAwait ( false ) ;
92+ var utf8Json = Encoding . Convert ( encoding , Encoding . UTF8 , byteArray ) ;
93+ return serializer . Deserialize ( utf8Json , objType , options ) ;
94+ }
95+
96+ if ( content . IsBuffered ( ) == false )
9097 {
9198 var utf8Json = await content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
9299 return await serializer . DeserializeAsync ( utf8Json , objType , options ) . ConfigureAwait ( false ) ;
93100 }
94101 else
95102 {
96- var byteArray = await content . ReadAsByteArrayAsync ( ) . ConfigureAwait ( false ) ;
97- var utf8Json = Encoding . Convert ( encoding , Encoding . UTF8 , byteArray ) ;
103+ var utf8Json = await content . ReadAsByteArrayAsync ( ) . ConfigureAwait ( false ) ;
98104 return serializer . Deserialize ( utf8Json , objType , options ) ;
99105 }
100106 }
You can’t perform that action at this time.
0 commit comments