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) 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).
Click to show internal directories.
Click to hide internal directories.