You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
882 B
C#
28 lines
882 B
C#
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));
|
|
}
|
|
}
|
|
}
|