Documentation
¶
Overview ¶
Package message decodes HTTP requests and responses into engine messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes HTTP payloads as the schema types that scripts declare, or that RPC paths name. It is immutable and safe for concurrent use.
func New ¶
func New(loaded *schema.Schema, set *descriptorpb.FileDescriptorSet, routes *route.Matcher, maxBodyBytes int) (*Decoder, error)
New checks the descriptors against the schema, and every declared request wildcard against its type, before decoding anything.
type Request ¶
type Request struct {
// Method is the HTTP request method.
Method string
// Host selects the destination's endpoints. Any port is ignored.
Host string
// Path is escaped, as endpoints match it the way ServeMux does.
Path string
// RawQuery is the encoded query string without the leading "?".
RawQuery string
// Header holds the request headers.
Header http.Header
// Body contains at most the configured capture limit.
Body []byte
// Overflow reports that Body is truncated and must not be decoded.
Overflow bool
}
Request is one captured dependency request.
type Response ¶
type Response struct {
// StatusCode is the backend's HTTP status before RPC-level status handling.
StatusCode int
Header http.Header
Trailer http.Header
// Body contains at most the configured capture limit.
Body []byte
}
Response is one captured response.
type ResponsePlan ¶
type ResponsePlan struct {
// contains filtered or unexported fields
}
ResponsePlan decodes the responses to one ingress request. A plan that failed to resolve reports the same error for every response, but still compares HTTP status.
func (ResponsePlan) Decode ¶
func (p ResponsePlan) Decode(response Response) protocol.Content
Decode returns a response's comparable content. A response with no message compares by status alone.
func (ResponsePlan) Ignored ¶
func (p ResponsePlan) Ignored() Option[string]
Ignored returns why the responses are never compared, if they are not.