AddJsonExceptionResponseFormatter Method
Definition
- Namespace
- Cuemon.Extensions.AspNetCore.Text.Json.Formatters
- Assemblies
- Cuemon.Extensions.AspNetCore.Text.Json.dll
AddJsonExceptionResponseFormatter(IServiceCollection, Action<JsonFormatterOptions>)
Adds an IHttpExceptionDescriptorResponseFormatter that uses JsonFormatter as engine of serialization to the specified list of services.
public static IServiceCollection AddJsonExceptionResponseFormatter(this IServiceCollection services, Action<JsonFormatterOptions> setup = null)
Parameters
servicesIServiceCollectionThe IServiceCollection to extend.
setupAction<JsonFormatterOptions>The JsonFormatterOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Remarks
Configuration of the JsonFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of JsonFormatterOptions.
Exceptions
- ArgumentNullException
servicescannot be null