package
0.0.0-20240217212545-fd00f1b629d2
Repository: https://github.com/jmeagher/monorepo.git
Documentation: pkg.go.dev
# Functions
AllowMethodsHandler will pass through any requests using a method in the allowed list.
No description provided by the author
CachedHTTPRequestBody returns the body of the request and stores a version of it in the returned request.
CachedResponseWriter returns a CachedResponse and *http.Request that can be passed down to other handlers.
DebugRequestHandler lots request information going through it.
DelayHandler just delays, that's it.
EvenSplitHandler splits traffic randomly between the handlers.
NewStructuredLogger builds a basic logger that can then be customized.
RandomSplitHandler randomly splits traffic between 2 handlers.
ReferenceClock for testing, see https://golang.org/pkg/time/#Time.Format.
RetryHandler will pass calls through a chain of http.Handler implementations until one is detected as not an error.
Simple5xxErrorHandler treats any response code 500 and above as an error.
SimpleRetryHandler will pass calls through a chain of http.Handler implementations until one is detected as not an error.
StaticHandler to return a static bit of simple content.
No description provided by the author
# Structs
No description provided by the author
LogRequest pulls together all the key information about the request and response so any additional log fields can be saved.
StructuredLogger controls what gets logged for each request.
# Interfaces
CachedResponse provides access to the response body and response Status code when passed down to any additional handlers.
TODO: Move this out to a better shared location Clock is a replacable clock implementation Initial version from https://stackoverflow.com/questions/18970265.
ErrorDetector allows a custom implementation for detecting if a response is an error or not.
# Type aliases
AddFields allows adding extra structured data based on the request and/or response.
ErrorDetectorFunc allows using a simple function as an ErrorDetector.