File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,12 @@ public static string GetHttpRequestLog(HttpRequestMessage request)
2121 {
2222 if ( request == null ) return string . Empty ;
2323
24- string body = ( request . Content == null ) ? string . Empty : FormatString ( request . Content . ReadAsStringAsync ( ) . Result ) ;
24+ string body = string . Empty ;
25+ try
26+ {
27+ body = FormatString ( request . Content . ReadAsStringAsync ( ) . Result ) ;
28+ }
29+ catch { }
2530
2631 StringBuilder stringBuilder = new StringBuilder ( ) ;
2732 stringBuilder . AppendLine ( $ "============================ HTTP REQUEST ============================{ Environment . NewLine } ") ;
@@ -36,7 +41,12 @@ public static string GetHttpResponseLog(HttpResponseMessage response)
3641 {
3742 if ( response == null ) return string . Empty ;
3843
39- string body = ( response . Content == null ) ? string . Empty : FormatString ( response . Content . ReadAsStringAsync ( ) . Result ) ;
44+ string body = string . Empty ;
45+ try
46+ {
47+ body = FormatString ( response . Content . ReadAsStringAsync ( ) . Result ) ;
48+ }
49+ catch { }
4050
4151 StringBuilder stringBuilder = new StringBuilder ( ) ;
4252 stringBuilder . AppendLine ( $ "============================ HTTP RESPONSE ============================{ Environment . NewLine } ") ;
You can’t perform that action at this time.
0 commit comments