(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func 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 | |
| 381 | func TestLoopbackStatebag(t *testing.T) { |
| 382 | routes := ` |
nothing calls this directly
no test coverage detected
searching dependent graphs…