Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TransactionInterceptor ¶
func TransactionInterceptor(storage Storage) func(APITransaction)
TransactionInterceptor creates a function to intercept and store API transactions
Types ¶
type APIInterceptor ¶
type APIInterceptor func(APITransaction)
APIInterceptor is a function that processes API transactions
type APITransaction ¶
type APITransaction struct {
Request RequestData
Response ResponseData
}
APITransaction represents a complete API transaction (request + response)
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
FileStorage stores API transactions as JSON files
func NewFileStorage ¶
func NewFileStorage(baseDir string) (*FileStorage, error)
NewFileStorage creates a new file storage
func (*FileStorage) Clear ¶
func (s *FileStorage) Clear() error
Clear removes all stored API transactions
func (*FileStorage) GetAll ¶
func (s *FileStorage) GetAll() ([]APITransaction, error)
GetAll returns all stored API transactions
func (*FileStorage) Store ¶
func (s *FileStorage) Store(transaction APITransaction) error
Store saves an API transaction to storage
type ProxyServer ¶
type ProxyServer struct {
// contains filtered or unexported fields
}
ProxyServer is an HTTP proxy server that captures API traffic
func NewProxyServer ¶
func NewProxyServer(port int, target string, interceptor APIInterceptor) (*ProxyServer, error)
NewProxyServer creates a new proxy server
type RequestData ¶
type RequestData struct {
Method string
Path string
QueryParams url.Values
Headers http.Header
Body []byte
Timestamp time.Time
}
RequestData stores information about an HTTP request
type ResponseData ¶
ResponseData stores information about an HTTP response
type Storage ¶
type Storage interface {
Store(transaction APITransaction) error
GetAll() ([]APITransaction, error)
Clear() error
}
Storage interface for storing API transactions