(originProxy connection.OriginProxy, hostname string)
| 465 | } |
| 466 | |
| 467 | func proxyHTTP(originProxy connection.OriginProxy, hostname string) (*http.Response, error) { |
| 468 | req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s", hostname), nil) |
| 469 | if err != nil { |
| 470 | return nil, err |
| 471 | } |
| 472 | |
| 473 | w := httptest.NewRecorder() |
| 474 | log := zerolog.Nop() |
| 475 | respWriter, err := connection.NewHTTP2RespWriter(req, w, connection.TypeHTTP, &log) |
| 476 | if err != nil { |
| 477 | return nil, err |
| 478 | } |
| 479 | |
| 480 | err = originProxy.ProxyHTTP(respWriter, tracing.NewTracedHTTPRequest(req, 0, &log), false) |
| 481 | if err != nil { |
| 482 | return nil, err |
| 483 | } |
| 484 | |
| 485 | return w.Result(), nil |
| 486 | } |
| 487 | |
| 488 | // nolint: testifylint // this is used inside go routines so it can't use `require.` |
| 489 | func tcpEyeball(t *testing.T, reqWriter io.WriteCloser, body string, respReadWriter *respReadWriteFlusher) { |
no test coverage detected