Table of Contents

AddJsonExceptionResponseFormatter Method

Definition

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

services IServiceCollection

The IServiceCollection to extend.

setup Action<JsonFormatterOptions>

The JsonFormatterOptions which may be configured.

Returns

IServiceCollection

A reference to services so 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

services cannot be null