RouteMatcher class¶
Defined in
Namespace: Refit.Testing
Assembly: Refit.Testing.dll
Full name: Refit.Testing.RouteMatcher
Modifiers: public sealed
Summary¶
Matches an incoming request by HTTP method and a path Template that mirrors the
[Get("/users/{id}")] attributes on a Refit interface. Build the common cases with the
Route factory; set the optional properties directly for finer matching.
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471
Remarks¶
The template is matched a segment at a time: a {name} segment matches any single non-empty
path segment, and every other segment must match literally. A relative template ("/users/1")
matches the request's absolute path; an absolute template ("https://api/users/1") matches the
whole scheme/host/path. Use "*" to match any path. The query string is matched by
Query, not the template.
Constructors¶
| Name | Summary |
|---|---|
| .ctor |
Properties¶
| Name | Summary |
|---|---|
| Method | Gets the HTTP method to match; null matches any method. |
| Template | Gets the path template to match (relative or absolute; {name} matches one segment; "*" matches any path). |
| Query | Gets query key/value pairs the request must contain (a partial match; other params allowed). |
| ExactQuery | Gets the exact raw query string (without the leading ?) the request must have. |
| ExactQueryParams | Gets the complete, decoded set of query pairs the request must have (no extras, order-insensitive). |
| Headers | Gets header name/value pairs the request must contain (request or content headers). |
| Body | Gets the exact request body the request must carry. |
| FormData | Gets form-encoded key/value pairs the request body must contain (a partial match). |
| Where | Gets an arbitrary predicate the request must satisfy. |
| WhereAsync | Gets an asynchronous predicate the request must satisfy, for matchers that await (e.g. reading the request body). |
| Reusable | Gets a value indicating whether this route may match repeatedly and is not required by [VerifyAllCalled](# |