Class BowireBodyMatcher
- Namespace
- Kuestenlogik.Bowire.Mocking
- Assembly
- Kuestenlogik.Bowire.dll
A request-body match predicate (mock matcher, #403). Exactly one
mode applies, in this precedence:
- JsonPath set → navigate into the JSON body and apply
the text op (EqualTo / Contains /
Matches) to the value there, or — with no op — assert the
path is present (or, with
present:false, absent). - EqualToJson set → semantic JSON equality against the whole body (order- and whitespace-insensitive), honouring IgnoreExtraElements and IgnoreArrayOrder.
- otherwise → the text op applies to the raw body string.
XPath and JSON-schema body matching are not yet implemented (tracked as a
follow-up on #403).
public sealed class BowireBodyMatcher
- Inheritance
-
BowireBodyMatcher
- Inherited Members
Constructors
BowireBodyMatcher()
public BowireBodyMatcher()
Properties
CaseInsensitive
Case-insensitive comparison for the text ops.
[JsonPropertyName("caseInsensitive")]
public bool CaseInsensitive { get; init; }
Property Value
Contains
Substring match (raw body, or the JsonPath value).
[JsonPropertyName("contains")]
public string? Contains { get; init; }
Property Value
EqualTo
Exact match (raw body, or the JsonPath value).
[JsonPropertyName("equals")]
public string? EqualTo { get; init; }
Property Value
EqualToJson
Expected JSON (as text) for semantic whole-body equality.
[JsonPropertyName("equalToJson")]
public string? EqualToJson { get; init; }
Property Value
IgnoreArrayOrder
For EqualToJson: compare arrays as multisets (order-independent).
[JsonPropertyName("ignoreArrayOrder")]
public bool IgnoreArrayOrder { get; init; }
Property Value
IgnoreExtraElements
For EqualToJson: allow the actual body to carry properties the expected doesn't.
[JsonPropertyName("ignoreExtraElements")]
public bool IgnoreExtraElements { get; init; }
Property Value
JsonPath
JSONPath into the body, e.g. \(.user.id</code> or <code>\).items[0].sku (also accepts the dotted user.id form).
[JsonPropertyName("jsonPath")]
public string? JsonPath { get; init; }
Property Value
Matches
Regex match (raw body, or the JsonPath value).
[JsonPropertyName("matches")]
public string? Matches { get; init; }
Property Value
Present
For JsonPath with no text op: true = path must exist, false = must NOT exist.
[JsonPropertyName("present")]
public bool? Present { get; init; }
Property Value
- bool?