Class ContentTooLargeError
- Namespace
- Trellis
- Assembly
- Trellis.Results.dll
Represents a content too large error when the server refuses a request because the content is larger than the server is willing or able to process. Maps to HTTP 413 Content Too Large (formerly Request Entity Too Large).
public sealed class ContentTooLargeError : Error, IEquatable<Error>
- Inheritance
-
ContentTooLargeError
- Implements
- Inherited Members
- Extension Methods
Examples
Error.ContentTooLarge("Request body exceeds the 10 MB limit.")
Error.ContentTooLarge("Request body exceeds the limit. Try again later.", RetryAfterValue.FromSeconds(60))
Remarks
Per RFC 9110 ยง15.5.14, if the condition is temporary, the server SHOULD generate
a Retry-After header to indicate when the client may try again.
Use the RetryAfter property to carry this metadata.
Constructors
ContentTooLargeError(string, string, RetryAfterValue?, string?)
Initializes a new instance of the ContentTooLargeError class.
public ContentTooLargeError(string detail, string code, RetryAfterValue? retryAfter = null, string? instance = null)
Parameters
detailstringDescription of why the content is too large.
codestringThe error code identifying this type of error.
retryAfterRetryAfterValueOptional retry-after value for temporary conditions.
instancestringOptional identifier for the resource.
Properties
RetryAfter
Gets the optional retry-after value indicating when the client may retry.
When present, Trellis response mappers emit the Retry-After header.
public RetryAfterValue? RetryAfter { get; }