Documentation
¶
Overview ¶
Package response evaluates optional webhook response acceptance rules. It does not load configuration, perform HTTP requests, or log response bodies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSON ¶
type JSON struct {
// Pointer is an RFC 6901 JSON Pointer to the expected value; empty selects the root.
Pointer string
// Equals contains the expected JSON value, including its type.
Equals json.RawMessage
// ErrorPointer is an optional RFC 6901 pointer to a scalar error message.
ErrorPointer string
}
JSON describes a typed JSON value match and optional error extraction.
type Rule ¶
type Rule struct {
// StatusCodes optionally overrides the accepted HTTP statuses.
StatusCodes []int
// Text validates a plain-text response when non-nil.
Text *Text
// JSON validates a JSON response when non-nil.
JSON *JSON
}
Rule specifies accepted HTTP statuses and at most one body matcher. With no StatusCodes, HTTP 2xx is accepted. The zero value checks status only.
func (Rule) Evaluate ¶
Evaluate checks the HTTP status and optional body matcher. Error details are extracted only through explicitly configured text or JSON matchers.
func (Rule) HasBodyMatcher ¶
HasBodyMatcher reports whether evaluation requires a complete response body.