Share via


IHttpLoggingInterceptor.OnResponseAsync(HttpLoggingInterceptorContext) Method

Definition

A callback to customize the logging of the response.

public System.Threading.Tasks.ValueTask OnResponseAsync (Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext logContext);
abstract member OnResponseAsync : Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext -> System.Threading.Tasks.ValueTask
Public Function OnResponseAsync (logContext As HttpLoggingInterceptorContext) As ValueTask

Parameters

Returns

Remarks

This is called when the first write to the response happens, or the response ends without a write, just before anything is sent to the client. Settings are carried over from OnRequestAsync(HttpLoggingInterceptorContext) (except the Parameters) and response settings may still be modified. Changes to request settings will have no effect. If no response fields are enabled, and the Parameters collection is empty, no response logging will occur. If CombineLogs is enabled then Parameters will carry over from the request to response and be logged together. RequestBody and ResponseBody can also be disabled in OnResponseAsync to prevent logging any buffered body data.

Applies to