MCPcopy
hub / github.com/cloudflare/cloudflared / proxyHTTP

Function proxyHTTP

orchestration/orchestrator_test.go:467–486  ·  view source on GitHub ↗
(originProxy connection.OriginProxy, hostname string)

Source from the content-addressed store, hash-verified

465}
466
467func 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.`
489func tcpEyeball(t *testing.T, reqWriter io.WriteCloser, body string, respReadWriter *respReadWriteFlusher) {

Callers 2

TestClosePreviousProxiesFunction · 0.85

Calls 4

NewHTTP2RespWriterFunction · 0.92
NewTracedHTTPRequestFunction · 0.92
ProxyHTTPMethod · 0.65
ResultMethod · 0.45

Tested by

no test coverage detected