Documentation ¶
Index ¶
Constants ¶
View Source
const LogBypassedKey contextKey = 0
Variables ¶
View Source
var ( ErrRequestNotFound = errors.New("reqlog: request not found") ErrProjectIDMustBeSet = errors.New("reqlog: project ID must be set") )
View Source
var ResLogSearchKeyFns = map[string]func(rl ResponseLog) string{ "res.proto": func(rl ResponseLog) string { return rl.Proto }, "res.statusCode": func(rl ResponseLog) string { return strconv.Itoa(rl.StatusCode) }, "res.statusReason": func(rl ResponseLog) string { return rl.Status }, "res.body": func(rl ResponseLog) string { return string(rl.Body) }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.0
type Config struct { Scope *scope.Scope Repository Repository }
type FindRequestsFilter ¶ added in v0.2.0
type FindRequestsFilter struct { ProjectID ulid.ULID OnlyInScope bool SearchExpr search.Expression }
type Repository ¶
type Repository interface { FindRequestLogs(ctx context.Context, filter FindRequestsFilter, scope *scope.Scope) ([]RequestLog, error) FindRequestLogByID(ctx context.Context, id ulid.ULID) (RequestLog, error) StoreRequestLog(ctx context.Context, reqLog RequestLog) error StoreResponseLog(ctx context.Context, reqLogID ulid.ULID, resLog ResponseLog) error ClearRequestLogs(ctx context.Context, projectID ulid.ULID) error }
type RequestLog ¶ added in v0.4.0
type RequestLog struct { ID ulid.ULID ProjectID ulid.ULID URL *url.URL Method string Proto string Header http.Header Body []byte Response *ResponseLog }
func (RequestLog) MatchScope ¶ added in v0.4.0
func (reqLog RequestLog) MatchScope(s *scope.Scope) bool
func (RequestLog) Matches ¶ added in v0.4.0
func (reqLog RequestLog) Matches(expr search.Expression) (bool, error)
Matches returns true if the supplied search expression evaluates to true.
type ResponseLog ¶ added in v0.4.0
type ResponseLog struct { Proto string StatusCode int Status string Header http.Header Body []byte }
func ParseHTTPResponse ¶ added in v0.5.0
func ParseHTTPResponse(res *http.Response) (ResponseLog, error)
type Service ¶
type Service interface { FindRequests(ctx context.Context) ([]RequestLog, error) FindRequestLogByID(ctx context.Context, id ulid.ULID) (RequestLog, error) ClearRequests(ctx context.Context, projectID ulid.ULID) error RequestModifier(next proxy.RequestModifyFunc) proxy.RequestModifyFunc ResponseModifier(next proxy.ResponseModifyFunc) proxy.ResponseModifyFunc SetActiveProjectID(id ulid.ULID) ActiveProjectID() ulid.ULID SetBypassOutOfScopeRequests(bool) BypassOutOfScopeRequests() bool SetFindReqsFilter(filter FindRequestsFilter) FindReqsFilter() FindRequestsFilter }
func NewService ¶
Click to show internal directories.
Click to hide internal directories.