Investigate creating a JSON-specific evaluator for request bodies.
Using System.Text.Json, this might look like either using the PipeReader (per ASP.NET Core docs advice on request operations, or passing the body stream to a Utf8JsonReader after enabling request buffering.
Care needs to be taken with the stream approach to ensure YARP can still correctly forward the request contents.
There is some advice at https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/use-utf8jsonreader, which also includes a section on using Utf8JsonReader with a ReadOnlySequence<byte>, which is applicable to the PipeReader option of implementing this.
Configuration should likely contain a way to specify a path for the particular json property to be evaluated against MatchValues
Investigate creating a JSON-specific evaluator for request bodies.
Using System.Text.Json, this might look like either using the
PipeReader(per ASP.NET Core docs advice on request operations, or passing the body stream to aUtf8JsonReaderafter enabling request buffering.Care needs to be taken with the stream approach to ensure YARP can still correctly forward the request contents.
There is some advice at https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/use-utf8jsonreader, which also includes a section on using
Utf8JsonReaderwith aReadOnlySequence<byte>, which is applicable to thePipeReaderoption of implementing this.Configuration should likely contain a way to specify a path for the particular json property to be evaluated against
MatchValues