Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTerminalResponse = errors.New("httpcache: terminal response written")
ErrTerminalResponse indicates the proxy must not write again: the handler already wrote the full HTTP response (e.g. cache HIT served from plugin.OnRequest).
Functions ¶
func AttachTerminalAwareProxyOnError ¶
func AttachTerminalAwareProxyOnError(cfg *middleware.ProxyConfig)
AttachTerminalAwareProxyOnError wraps cfg.OnError so cache HITs (ErrTerminalResponse) do not get a second write.
func DefaultProxyOnError ¶
func DefaultProxyOnError(err error, rw http.ResponseWriter, req *http.Request)
DefaultProxyOnError mirrors github.com/go-zoox/proxy defaultOnError so we can wrap cfg.OnError and skip writing when ErrTerminalResponse is returned from OnRequest.
func IsTerminalResponse ¶
IsTerminalResponse reports whether err signals that the response body was already sent.
Types ¶
type HTTPCachePlugin ¶
HTTPCachePlugin caches GET (or configured methods) responses in Application.Cache().
func (*HTTPCachePlugin) OnResponse ¶
OnResponse stores cacheable responses after the upstream returns.
func (*HTTPCachePlugin) Prepare ¶
func (h *HTTPCachePlugin) Prepare(app *zoox.Application, cfg *config.Config) error
Prepare loads config and attaches the gateway cache backend.