// WrapFilter wraps `func(http.Handler) http.Handler` into `web.FilterFunc`
559957
func WrapFilter(f func(http.Handler) http.Handler) Filter {
	fn := func(next HandlerFunc) HandlerFunc {
		return func(c Context) (err error) {
			f(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
				c.(*context).request = r
				err = next(c)
			})).ServeHTTP(c.Response(), c.Request())
			return
		}
	}
	return FilterFunc(fn)
}
261281
func WrapHandler(handler *Handler) alice.Constructor {
	return func(next http.Handler) (http.Handler, error) {
		return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
			handler.ServeHTTP(rw, req, next)
		}), nil
	}
}
679345
func wrapCORS(f func(http.ResponseWriter, *http.Request)) http.Handler {
	return allowCORS.Handler(http.HandlerFunc(f))
}
1363654
func Filter(ff FilterFunc) Option {
	return func(s *Scroller) error {
		s.filter = ff
		return nil
	}
}
925657
func (m *RouteMux) Filter(filter http.HandlerFunc) {
	m.filters = append(m.filters, filter)
}
533986
func (l *RateLimiter) WrapHandle(h http.Handler) {
	l.TokenLimiter.Wrap(h)
}
1150013
func defaultFilter(w http.ResponseWriter, r *http.Request) bool {
	hdr := w.Header()
	for _, tp := range defaultFilterTypes {
		ok := HeaderMatch(hdr, "Content-Type", HmContains, tp)
		if ok {
			return true
		}
	}
	return false
}
602918
func StatusFilter(status rspb.Status_Code) FilterFunc {
	return FilterFunc(func(rls *rspb.Release) bool {
		if rls == nil {
			return true
		}
		return rls.GetInfo().GetStatus().Code == status
	})
}
157695
func (a *Client) PatchPrefilter(params *PatchPrefilterParams) (*PatchPrefilterOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPatchPrefilterParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "PatchPrefilter",
		Method:             "PATCH",
		PathPattern:        "/prefilter",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PatchPrefilterReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PatchPrefilterOK), nil

}
635764
func (n *Notifier) AddFilter(fn func(*Notice) *Notice) {
	n.filters = append(n.filters, fn)
}
381118
func URLLengthFilter(c *colly.Collector, URLLengthLimit int) {
	c.OnRequest(func(r *colly.Request) {
		if len(r.URL.String()) > URLLengthLimit {
			r.Abort()
		}
	})
}
753715
func (c *Container) HandleWithFilter(pattern string, handler http.Handler) {
	f := func(httpResponse http.ResponseWriter, httpRequest *http.Request) {
		if len(c.containerFilters) == 0 {
			handler.ServeHTTP(httpResponse, httpRequest)
			return
		}

		chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) {
			handler.ServeHTTP(httpResponse, httpRequest)
		}}
		chain.ProcessFilter(NewRequest(httpRequest), NewResponse(httpResponse))
	}

	c.Handle(pattern, http.HandlerFunc(f))
}
710734
func (f *Filters) AddFilter(key, op, value string) {
	filter := &filter{Key: key, Op: op, Val: value}
	f.f = append(f.f, filter)
}
1137859
func XSSFilter() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
	}
}
653117
func (m *RouteMux) FilterParam(param string, filter http.HandlerFunc) {
	if !strings.HasPrefix(param,":") {
		param = ":"+param
	}

	m.Filter(func(w http.ResponseWriter, r *http.Request) {
		p := r.URL.Query().Get(param)
		if len(p) > 0 { filter(w, r) }
	})
}
20072
func WrapHandlerForAuth(h http.Handler) http.Handler {
	return WrapHandlerForAuthCreds(h, _adminuser, _adminpass, _authrealm)
}
831073
func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
	return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
		w.Header().Set("Docker-Experimental", e.experimental)
		return handler(ctx, w, r, vars)
	}
}