Skip to content

StubResponse class

Defined in

Namespace: Refit.Testing Assembly: Refit.Testing.dll Full name: Refit.Testing.StubResponse Modifiers: public sealed

Summary

View source

The response a StubHttp returns for a matched RouteMatcher. Build it with the Reply factory rather than constructing it directly; the properties are exposed so a test can read what a reply carries.

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

Constructors

NameSummary
.ctor

Properties

NameSummary
StatusGets the response status code. Defaults to OK.
JsonGets a raw JSON response body; sets the content type to application/json.
TextGets a plain-text response body paired with [ContentType](# (default text/plain).
ContentTypeGets the content type for [Text](#
ContentGets an explicit response content, used verbatim.
ResponderGets a factory that produces the full response from the request, for total control.
ResponderAsyncGets an asynchronous factory that produces the full response, for responders that await. Takes precedence over [Responder](#
Inherited members