MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / roundtrip

Method roundtrip

proxy/proxy_test.go:798–822  ·  view source on GitHub ↗
(addr string)

Source from the content-addressed store, hash-verified

796}
797
798func (p *pipedRequestBody) roundtrip(addr string) []byte {
799 header := http.Header{}
800 conn, resp, err := p.dialer.Dial(addr, header)
801 if err != nil {
802 panic(err)
803 }
804 defer conn.Close()
805 defer resp.Body.Close()
806
807 if resp.StatusCode != http.StatusSwitchingProtocols {
808 panic(fmt.Errorf("resp returned status code: %d", resp.StatusCode))
809 }
810
811 err = conn.WriteMessage(gorillaWS.TextMessage, p.messageToWrite)
812 if err != nil {
813 panic(err)
814 }
815
816 _, data, err := conn.ReadMessage()
817 if err != nil {
818 panic(err)
819 }
820
821 return data
822}
823
824func (p *pipedRequestBody) Read(data []byte) (n int, err error) {
825 return p.pipedConn.Read(data)

Callers 1

TestConnectionsFunction · 0.80

Calls 3

ErrorfMethod · 0.80
DialMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected