using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DS.WMS.JobService { public class SampleProblemDetailsWriter : IProblemDetailsWriter { // Indicates that only responses with StatusCode == 400 // are handled by this writer. All others are // handled by different registered writers if available. public bool CanWrite(ProblemDetailsContext context) => context.HttpContext.Response.StatusCode == 400; public ValueTask WriteAsync(ProblemDetailsContext context) { // Additional customizations. // Write to the response. var response = context.HttpContext.Response; return new ValueTask(response.WriteAsJsonAsync(context.ProblemDetails)); } } }