Documentation
¶
Overview ¶
Package httpfixture replays HTTP exchanges without simulating remote state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Body ¶
type Body struct {
JSON any `yaml:"json"`
}
Body distinguishes an absent HTTP body from a JSON value, including JSON null.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler permits independent requests to interleave and consumes identical request signatures FIFO. A mutex keeps matching and consumption atomic.
func NewHandler ¶
func NewHandler() *Handler
NewHandler returns an empty handler; fixture sets are configured separately.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP prefers consumable step fixtures over reusable fallbacks. Matching and consumption share a lock so concurrent requests cannot consume a call twice.
func (*Handler) SetReusableFixtures ¶
SetReusableFixtures replaces test-wide fallback exchanges, such as metadata. They survive step transitions, may be matched repeatedly, and need not be consumed. Invalid fixtures leave the previous set intact.