standin

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package standin is the stand-in for a service's HTTP neighbour: it answers what the steps declared, checks the traffic against the neighbour's OpenAPI document and keeps what was sent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func New

func New(o Options) (*Backend, error)

func (*Backend) Failures

func (b *Backend) Failures() []string

func (*Backend) Hold

func (b *Backend) Hold(method, path string, query ...url.Values)

func (*Backend) Release

func (b *Backend) Release(method, path string, query ...url.Values) error

func (*Backend) Reply

func (b *Backend) Reply(method, path string, status int, body any, opts ...Option)

func (*Backend) ReplyTo

func (b *Backend) ReplyTo(method, path string, query url.Values, status int, body any, opts ...Option)

func (*Backend) Requests

func (b *Backend) Requests(method, path string) []Received

func (*Backend) RoundTrip

func (b *Backend) RoundTrip(req *http.Request) (*http.Response, error)

func (*Backend) TimeOut

func (b *Backend) TimeOut(method, path string, query ...url.Values)

type Option

type Option func(*reply)
func Header(name, value string) Option

type Options

type Options struct {
	Name     string // how failures name the neighbour
	Contract string // its OpenAPI 3 document, a path as the suite's working directory reaches it; empty means no check
	Failure  string // a components.schemas name: the body a 5xx may carry on any route
}

type Received

type Received struct {
	Method string
	Path   string
	Query  url.Values
	Header http.Header
	Body   []byte
}

func (Received) JSON

func (r Received) JSON(into any) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL