I am having issues figuring out how to stop a YARP request early and return a custom response if a certain condition is not met inside a request transform.
builderContext.AddRequestTransform(async transformContext =>
{
[...]
if (!condition)
{
// TODO: stop request and return response
}
[...]
});
I have tried simply setting transformContext.HttpContext.Response.Status to a non-success status code as you would do for middleware, however this does not seem to work, and I have not been able to find another solution to this issue.