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

Method Split

proxy/context.go:290–316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

288}
289
290func (c *context) Split() (filters.FilterContext, error) {
291 originalRequest := c.Request()
292 if c.proxy.experimentalUpgrade && isUpgradeRequest(originalRequest) {
293 return nil, errors.New("context: cannot split the context that contains an upgrade request")
294 }
295 cc := c.clone()
296 cc.stateBag = map[string]interface{}{}
297 cc.responseWriter = noopFlushedResponseWriter{}
298 cc.metrics = &filterMetrics{
299 prefix: cc.metrics.prefix,
300 impl: cc.proxy.metrics,
301 }
302 u := new(url.URL)
303 *u = *originalRequest.URL
304 u.Host = originalRequest.Host
305 cr, body, err := cloneRequestForSplit(u, originalRequest)
306 if err != nil {
307 c.Logger().Errorf("context: failed to clone request: %v", err)
308 return nil, err
309 }
310 serverSpan := opentracing.SpanFromContext(originalRequest.Context())
311 cr = cr.WithContext(opentracing.ContextWithSpan(cr.Context(), serverSpan))
312 cr = cr.WithContext(routing.NewContext(cr.Context()))
313 originalRequest.Body = body
314 cc.request = cr
315 return cc, nil
316}
317
318func (c *context) Loopback() {
319 c.loopbackInternal(true)

Callers

nothing calls this directly

Calls 9

RequestMethod · 0.95
cloneMethod · 0.95
LoggerMethod · 0.95
NewContextFunction · 0.92
isUpgradeRequestFunction · 0.85
cloneRequestForSplitFunction · 0.85
NewMethod · 0.80
ContextMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected