Table of Contents

Class UnsupportedMediaTypeError

Namespace
Trellis
Assembly
Trellis.Results.dll

Represents an unsupported media type error when the server refuses a request because the content type is not supported for the target resource. Maps to HTTP 415 Unsupported Media Type.

public sealed class UnsupportedMediaTypeError : Error, IEquatable<Error>
Inheritance
UnsupportedMediaTypeError
Implements
Inherited Members
Extension Methods

Examples

Error.UnsupportedMediaType("application/xml is not supported. Use application/json.")

Remarks

Per RFC 9110 ยง15.5.16, this error indicates the content's media type or content encoding is not supported. When the issue is an unsupported content coding, the response ought to include an Accept-Encoding header listing the supported codings.

Constructors

UnsupportedMediaTypeError(string, string, string?)

Initializes a new instance of the UnsupportedMediaTypeError class.

public UnsupportedMediaTypeError(string detail, string code, string? instance = null)

Parameters

detail string

Description of why the media type is not supported.

code string

The error code identifying this type of error.

instance string

Optional identifier for the resource.