package
4.1.0+incompatible
Repository: https://github.com/optimizely/agent.git
Documentation: pkg.go.dev
# Functions
No description provided by the author
AllowedHosts returns a middleware function that rejects requests whose host value does not match any host in allowedHosts.
BatchRouter intercepts requests for the given url to return a StatusOK.
CoerceType coerces typed value from string.
GetExperiment returns an OptimizelyExperiment from the request context.
GetFeature returns an OptimizelyFeature from the request context.
GetLogger gets the logger with some info coming from http request.
GetOptlyClient is a utility to extract the OptlyClient from the http request context.
Metricize updates counts, total response time, and response time histogram for each URL hit, key being a combination of a method and route pattern.
NewAuth makes Auth middleware.
NewBatchResponse constructs a BatchResponse with default values.
NewJWTVerifier creates JWTVerifier with secret key.
NewJWTVerifierURL creates JWTVerifierURL with JWKS URL.
NewResponseCollector constructs a ResponseCollector with default values.
RenderError sets the request status and renders the error message.
SetRequestID sets request ID obtained from the request header itself or from newly generated id.
SetTime middleware sets the start time in request context.
# Constants
OptlyClientKey is the context key for the OptlyClient.
OptlyContextKey is the context key for the OptlyContext.
OptlyExperimentKey is the context key used by ExperimentCtx for setting an Experiment.
OptlyFeatureKey is the context key used by FeatureCtx for setting a Feature.
OptlyODPCacheHeader is the header key for an ad-hoc ODP Cache name.
OptlyRequestHeader is the header key for the request ID.
OptlySDKHeader is the header key for an ad-hoc SDK key.
OptlyUPSHeader is the header key for an ad-hoc UserProfileService name.
# Structs
Auth is the middleware for all REST API's.
BatchOperation defines a single request within a batch.
BatchRequest is the original request that is used for batching.
BatchResponse has the structure for the final response.
CachedOptlyMiddleware implements OptlyMiddleware backed by a cache.
ErrorResponse Model.
JWTVerifier checks token with JWT, implements Verifier.
JWTVerifierURL checks token with JWT against JWKS, implements Verifier.
NoAuth is NoOp for auth.
ResponseCollector collects responses for the writer.