MCPcopy Index your code
hub / github.com/zalando/skipper / TestLoopbackPathParams

Function TestLoopbackPathParams

proxy/loopback_test.go:352–379  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

350}
351
352func TestLoopbackPathParams(t *testing.T) {
353 routes := `
354 entry: Path("/:param/path")
355 -> appendResponseHeader("X-Entry-Route-Done", "true")
356 -> returnParam() // should add "test"
357 -> setRequestHeader("X-Loop-Route", "1")
358 -> setPath("/")
359 -> <loopback>;
360
361 loopRoute1: Header("X-Loop-Route", "1")
362 -> appendResponseHeader("X-Loop-Route-Done", "1")
363 -> setRequestHeader("X-Loop-Route", "2")
364 -> setPath("/loop-test/path")
365 -> <loopback>;
366
367 loopRoute2: Path("/:param/path") && Header("X-Loop-Route", "2")
368 -> appendResponseHeader("X-Loop-Route-Done", "2")
369 -> returnParam() // should add "loop-test"
370 -> "$backend";
371 `
372
373 testLoopback(t, routes, Params{}, nil, http.StatusOK, http.Header{
374 "X-Entry-Route-Done": []string{"true"},
375 "X-Loop-Route-Done": []string{"1", "2"},
376 "X-Backend-Done": []string{"true"},
377 "X-Path-Param": []string{"test", "loop-test"},
378 })
379}
380
381func TestLoopbackStatebag(t *testing.T) {
382 routes := `

Callers

nothing calls this directly

Calls 1

testLoopbackFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…