Class PreviewHttpMock

A routed set of stub HTTP responses the preview host returns without touching the network. Rules are matched in order by method + path; the first match wins, else Default, else a benign 200. Built via the WithHttpResponse(builder => ...) overload; the flat WithHttpResponse(content) overload maps to a single Default.

Inheritance
PreviewHttpMock
Namespace: BlazorToolkit.Previews
Assembly: BlazorToolkit.Previews.dll
Syntax
public sealed class PreviewHttpMock

Constructors

PreviewHttpMock()

Declaration
public PreviewHttpMock()

Properties

Default

Response for requests no rule matched. Null falls back to a benign 200 "null" JSON body.

Declaration
public PreviewHttpResponse? Default { get; set; }
Property Value
Type Description
PreviewHttpResponse

Rules

Ordered match rules; the first whose method and path match a request supplies the response.

Declaration
public List<PreviewHttpRule> Rules { get; }
Property Value
Type Description
List<PreviewHttpRule>