MCPcopy Create free account
hub / github.com/zalando/skipper / rejectBackend

Method rejectBackend

proxy/proxy.go:1237–1251  ·  view source on GitHub ↗
(ctx *context, req *http.Request)

Source from the content-addressed store, hash-verified

1235}
1236
1237func (p *Proxy) rejectBackend(ctx *context, req *http.Request) (*http.Response, bool) {
1238 limit, ok := ctx.StateBag()[filters.BackendRatelimit].(*ratelimitfilters.BackendRatelimit)
1239 if ok {
1240 s := req.URL.Scheme + "://" + req.URL.Host
1241
1242 if !p.limiters.Get(limit.Settings).Allow(req.Context(), s) {
1243 return &http.Response{
1244 StatusCode: limit.StatusCode,
1245 Header: http.Header{"Content-Length": []string{"0"}},
1246 Body: io.NopCloser(&bytes.Buffer{}),
1247 }, true
1248 }
1249 }
1250 return nil, false
1251}
1252
1253func (p *Proxy) checkBreaker(c *context) (func(bool), bool) {
1254 if p.breakers == nil {

Callers 1

makeBackendRequestMethod · 0.95

Calls 4

ContextMethod · 0.80
StateBagMethod · 0.65
AllowMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected