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

Function testProxyHTTP

proxy/proxy_test.go:177–192  ·  view source on GitHub ↗
(proxy connection.OriginProxy)

Source from the content-addressed store, hash-verified

175}
176
177func testProxyHTTP(proxy connection.OriginProxy) func(t *testing.T) {
178 return func(t *testing.T) {
179 responseWriter := newMockHTTPRespWriter()
180 req, err := http.NewRequest(http.MethodGet, "http://localhost:8080", nil)
181 require.NoError(t, err)
182
183 log := zerolog.Nop()
184 err = proxy.ProxyHTTP(responseWriter, tracing.NewTracedHTTPRequest(req, 0, &log), false)
185 require.NoError(t, err)
186 for _, tag := range testTags {
187 assert.Equal(t, tag.Value, req.Header.Get(TagHeaderNamePrefix+tag.Name))
188 }
189
190 assert.Equal(t, http.StatusOK, responseWriter.Code)
191 }
192}
193
194func testProxyWebsocket(proxy connection.OriginProxy) func(t *testing.T) {
195 return func(t *testing.T) {

Callers 1

TestProxySingleOriginFunction · 0.85

Calls 5

NewTracedHTTPRequestFunction · 0.92
newMockHTTPRespWriterFunction · 0.85
GetMethod · 0.80
ProxyHTTPMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected