replay

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReplayOverride

type ReplayOverride struct {
	Method  string              `json:"method,omitempty"`
	URL     string              `json:"url,omitempty"`
	Headers map[string][]string `json:"headers,omitempty"`
	Body    string              `json:"body,omitempty"`
}

ReplayOverride specifies modifications to make to a request before re-executing it.

type ReplayResult

type ReplayResult struct {
	RequestID string                 `json:"request_id"`
	Original  *storage.RequestRecord `json:"original"`
	Replayed  *ReplayedResponse      `json:"replayed"`
	Diff      *ResponseDiff          `json:"diff"`
}

ReplayResult encapsulates the entire retest transaction and comparison.

type ReplayedResponse

type ReplayedResponse struct {
	StatusCode int                 `json:"status_code"`
	DurationMs float64             `json:"duration_ms"`
	Headers    map[string][]string `json:"headers"`
	Body       string              `json:"body"`
}

ReplayedResponse contains the outcome of re-transmitting the request.

type Replayer

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

Replayer executes intercepted requests with optional overrides and computes response diffs.

func NewReplayer

func NewReplayer(timeout time.Duration, insecureTLS bool) *Replayer

NewReplayer initializes a Replayer with reasonable timeouts and TLS options.

func (*Replayer) Replay

func (r *Replayer) Replay(orig *storage.RequestRecord, override *ReplayOverride) (*ReplayResult, error)

Replay sends the request (with overrides) and compares it with the original transaction.

type ResponseDiff

type ResponseDiff struct {
	StatusChanged   bool     `json:"status_changed"`
	OldStatus       int      `json:"old_status"`
	NewStatus       int      `json:"new_status"`
	LatencyDiffMs   float64  `json:"latency_diff_ms"`
	HeadersAdded    []string `json:"headers_added"`
	HeadersRemoved  []string `json:"headers_removed"`
	HeadersModified []string `json:"headers_modified"`
	BodyChanged     bool     `json:"body_changed"`
	BodySummary     string   `json:"body_summary"`
}

ResponseDiff outlines semantic variances between original and replayed responses.

func ComputeDiff

func ComputeDiff(orig *storage.RequestRecord, replayed *ReplayedResponse) *ResponseDiff

ComputeDiff calculates structural, header, status, and latency changes.

Jump to

Keyboard shortcuts

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