Table of Contents

AddYamlExceptionResponseFormatter Method

Definition

AddYamlExceptionResponseFormatter(IServiceCollection, Action<YamlFormatterOptions>)

Adds an IHttpExceptionDescriptorResponseFormatter that uses YamlFormatter as engine of serialization to the specified list of services.

public static IServiceCollection AddYamlExceptionResponseFormatter(this IServiceCollection services, Action<YamlFormatterOptions> setup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

setup Action<YamlFormatterOptions>

The YamlFormatterOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Remarks

Configuration of the YamlFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of YamlFormatterOptions.

Exceptions

ArgumentNullException

services cannot be null