This commit is contained in:
2023-12-16 21:19:41 +02:00
parent 2feaf50802
commit f495fc9b8f
@@ -21,11 +21,11 @@ public class ResponseFilter : IActionFilter
public void OnActionExecuted(ActionExecutedContext context) public void OnActionExecuted(ActionExecutedContext context)
{ {
if (context.Result == null) if (context.Result == null)
throw new NotSupportedException($"Response must be - empty"); throw new NotSupportedException($"Response required");
if (!(context.Result is ObjectResult result)) if (!(context.Result is ObjectResult result))
throw new NotSupportedException($"Response must be an ObjectResult - {context.Result?.GetType().Name}"); throw new NotSupportedException($"Response must be an ObjectResult - {context.Result?.GetType().Name}");
if (result.Value == null) if (result.Value == null)
throw new NotSupportedException($"Response must be an ObjectResult - empty"); throw new NotSupportedException($"Response must be an ObjectResult with value");
if (result.Value is IResponseModel) if (result.Value is IResponseModel)
{ {