AKlaus / DomainResult

Tiny package for decoupling domain operation results from IActionResult and IResult types of ASP.NET Web API
Apache License 2.0
53 stars 3 forks source link

Add `Retry-After` HTTP header [optional] to HTTP 503 & 413 responses #67

Open AKlaus opened 8 months ago

AKlaus commented 8 months ago

Following up #45 and #63 issues, the devs might want to return a value in the Retry-After header. As per the specs on 413 and 503 HTTP codes:

This response should be used for temporary conditions and the Retry-After HTTP header should, if possible, contain the estimated time for the recovery of the service.

To get it done, the implementation should include:

  1. An optional int parameter (to indicate the waiting period) to IDomainResult in methods ContentTooLarge() and CriticalDependencyError().
  2. Handle the field in conversions in DomainResultExtensions and DomainResultExtensions in DomainResults.Mvc project.

This would require breaking changes to IDomainResultBase interface to store the Retry-After, which might add unnecessary complexity which will be consumed just by a handful of devs.