@@ -79,7 +79,7 @@ private async Task InvokeInternal(HttpContext context)
7979 if ( ( HttpLoggingFields . Request & options . LoggingFields ) != HttpLoggingFields . None )
8080 {
8181 var request = context . Request ;
82- var list = new List < KeyValuePair < string , string ? > > (
82+ var list = new List < KeyValuePair < string , object ? > > (
8383 request . Headers . Count + DefaultRequestFieldsMinusHeaders ) ;
8484
8585 if ( options . LoggingFields . HasFlag ( HttpLoggingFields . RequestProtocol ) )
@@ -202,20 +202,19 @@ private async Task InvokeInternal(HttpContext context)
202202 }
203203 }
204204
205- private static void AddToList ( List < KeyValuePair < string , string ? > > list , string key , string ? value )
205+ private static void AddToList ( List < KeyValuePair < string , object ? > > list , string key , string ? value )
206206 {
207- list . Add ( new KeyValuePair < string , string ? > ( key , value ) ) ;
207+ list . Add ( new KeyValuePair < string , object ? > ( key , value ) ) ;
208208 }
209209
210210 public static void LogResponseHeaders ( HttpResponse response , HttpLoggingOptions options , ILogger logger )
211211 {
212- var list = new List < KeyValuePair < string , string ? > > (
212+ var list = new List < KeyValuePair < string , object ? > > (
213213 response . Headers . Count + DefaultResponseFieldsMinusHeaders ) ;
214214
215215 if ( options . LoggingFields . HasFlag ( HttpLoggingFields . ResponseStatusCode ) )
216216 {
217- list . Add ( new KeyValuePair < string , string ? > ( nameof ( response . StatusCode ) ,
218- response . StatusCode . ToString ( CultureInfo . InvariantCulture ) ) ) ;
217+ list . Add ( new KeyValuePair < string , object ? > ( nameof ( response . StatusCode ) , response . StatusCode ) ) ;
219218 }
220219
221220 if ( options . LoggingFields . HasFlag ( HttpLoggingFields . ResponseHeaders ) )
@@ -228,7 +227,7 @@ public static void LogResponseHeaders(HttpResponse response, HttpLoggingOptions
228227 logger . ResponseLog ( httpResponseLog ) ;
229228 }
230229
231- internal static void FilterHeaders ( List < KeyValuePair < string , string ? > > keyValues ,
230+ internal static void FilterHeaders ( List < KeyValuePair < string , object ? > > keyValues ,
232231 IHeaderDictionary headers ,
233232 HashSet < string > allowedHeaders )
234233 {
@@ -237,10 +236,10 @@ internal static void FilterHeaders(List<KeyValuePair<string, string?>> keyValues
237236 if ( ! allowedHeaders . Contains ( key ) )
238237 {
239238 // Key is not among the "only listed" headers.
240- keyValues . Add ( new KeyValuePair < string , string ? > ( key , Redacted ) ) ;
239+ keyValues . Add ( new KeyValuePair < string , object ? > ( key , Redacted ) ) ;
241240 continue ;
242241 }
243- keyValues . Add ( new KeyValuePair < string , string ? > ( key , value . ToString ( ) ) ) ;
242+ keyValues . Add ( new KeyValuePair < string , object ? > ( key , value . ToString ( ) ) ) ;
244243 }
245244 }
246245 }
0 commit comments