Documentation
¶
Index ¶
- func ActiveProvider() string
- func Disable()
- func Enable(provider string)
- func FirstNonEmpty(values ...string) string
- func IsActive() bool
- func IsActiveForProvider(provider string) bool
- func JSONResponse(req *http.Request, statusCode int, payload any) *http.Response
- func NonEmptyStrings(values ...string) []string
- func ParseInt(value string, fallback int) int
- func ReadRequestBody(req *http.Request) ([]byte, error)
- func Response(req *http.Request, statusCode int, contentType string, body []byte) *http.Response
- func SubtleEqual(left, right string) bool
- func SupportedPayloads(provider string) []string
- func SupportsProvider(provider string) bool
- func XMLResponse(req *http.Request, statusCode int, payload any) *http.Response
- type AuthFailureKind
- type Credentials
- type NamedValue
- type State
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveProvider ¶
func ActiveProvider() string
func FirstNonEmpty ¶ added in v0.3.1
FirstNonEmpty returns the first trimmed non-empty value.
func IsActiveForProvider ¶
func JSONResponse ¶ added in v0.3.1
JSONResponse builds a 200-style JSON response bound to req with the marshalled payload.
func NonEmptyStrings ¶ added in v0.3.1
NonEmptyStrings returns trimmed copies of every non-empty input value.
func ParseInt ¶ added in v0.3.1
ParseInt parses value or returns fallback when empty / unparsable / non-positive.
func ReadRequestBody ¶ added in v0.3.1
ReadRequestBody drains req.Body and rewires it so downstream handlers can read it again.
func Response ¶ added in v0.3.1
Response is the shared response constructor used by JSONResponse / XMLResponse.
func SubtleEqual ¶ added in v0.3.1
SubtleEqual reports whether two strings are equal in constant time.
func SupportedPayloads ¶
func SupportsProvider ¶
Types ¶
type AuthFailureKind ¶ added in v0.3.1
type AuthFailureKind int
AuthFailureKind classifies the outcome of replay-side request authentication.
const ( AuthOK AuthFailureKind = iota AuthInvalidAccessKey AuthInvalidSignature )
type Credentials ¶
type Credentials struct {
AccessKey string
SecretKey string
// Extras carry additional option-key / value pairs needed to fully
// configure providers that do not fit the AccessKey + SecretKey shape
// (e.g. azure tenantId / subscriptionId, gcp base64Json). They are
// surfaced in the demo replay banner alongside AccessKey / SecretKey.
Extras []NamedValue
// HideDefaultLabels suppresses the "AccessKey: …" / "SecretKey: …" rows
// in the demo banner for providers whose auth model does not use those
// labels (azure: clientId/clientSecret, gcp: base64Json). The struct
// fields are still populated for replay transport / cache lookups; they
// just shouldn't surface as user-facing copy targets when the operator
// fills the form using native field names from Extras.
HideDefaultLabels bool
}
func CredentialsFor ¶
func CredentialsFor(provider string) (Credentials, bool)
type NamedValue ¶ added in v0.3.1
NamedValue is a key/value pair used by demo replay banners and option-fill helpers to advertise extra credential fields.
type Window ¶ added in v0.3.1
Window is the half-open index range [Start, End) used to paginate fixtures.
func OffsetWindow ¶ added in v0.3.1
OffsetWindow computes the slice for offset/limit-style pagination.
func PageWindow ¶ added in v0.3.1
PageWindow computes the slice for 1-based pagination.