(addr string)
| 796 | } |
| 797 | |
| 798 | func (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 | |
| 824 | func (p *pipedRequestBody) Read(data []byte) (n int, err error) { |
| 825 | return p.pipedConn.Read(data) |
no test coverage detected