history

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestRecord

type RequestRecord struct {
	ID        string          `json:"id"`
	Timestamp time.Time       `json:"timestamp"`
	Method    string          `json:"method"`
	Path      string          `json:"path"`
	Query     string          `json:"query,omitempty"`
	Headers   http.Header     `json:"headers"`
	Body      []byte          `json:"body,omitempty"`
	Response  *ResponseRecord `json:"response,omitempty"`
}

RequestRecord captures details of an HTTP request served by the mock.

type ResponseRecord

type ResponseRecord struct {
	StatusCode int           `json:"statusCode"`
	Headers    http.Header   `json:"headers"`
	Body       []byte        `json:"body,omitempty"`
	Duration   time.Duration `json:"duration"`
}

ResponseRecord captures details of the HTTP response.

type RingBuffer

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

RingBuffer is a fixed‑size circular buffer for request records.

func NewRingBuffer

func NewRingBuffer(capacity int) *RingBuffer

NewRingBuffer creates a new ring buffer with the given capacity.

func (*RingBuffer) Add

func (b *RingBuffer) Add(r RequestRecord)

Add adds a request record to the buffer, overwriting the oldest if full.

func (*RingBuffer) Capacity

func (b *RingBuffer) Capacity() int

Capacity returns the buffer capacity.

func (*RingBuffer) Clear

func (b *RingBuffer) Clear()

Clear removes all records.

func (*RingBuffer) Count

func (b *RingBuffer) Count() int

Count returns the current number of records.

func (*RingBuffer) GetAll

func (b *RingBuffer) GetAll() []RequestRecord

GetAll returns all records in chronological order (oldest first).

Jump to

Keyboard shortcuts

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