// RoundTrip dials the unix domain socket, sends the request and processes the
// response.
RoundTrip dials the unix domain socket, sends the request and processes the
response.
// RoundTrip dials the unix domain socket sends the request and processes the // response .
func (s SocketRoundtripper) RoundTrip(req *http.Request) (*http.Response, error) {
	if req.Body != nil {
		defer req.Body.Close()
	}
	socket, err := net.Dial("unix", s.path)
	if err != nil {
		return nil, err
	}
	defer socket.Close()
	socket.SetWriteDeadline(time.Now().Add(5 * time.Second))
	if err := req.Write(socket); err != nil {
		return nil, err
	}
	socket.SetReadDeadline(time.Now().Add(5 * time.Second))
	reader := bufio.NewReader(socket)
	return http.ReadResponse(reader, req)
}
func ( s SocketRoundtripper ) RoundTrip ( req * http . Request ) ( * http . Response , error ) { if req . Body != nil { defer req . Body . Close ( ) } socket , err := net . Dial ( " " , s . path ) if err != nil { return nil , err } defer socket . Close ( ) socket . SetWriteDeadline ( time . Now ( ) . Add ( 5 * time . Second ) ) if err := req . Write ( socket ) ; err != nil { return nil , err } socket . SetReadDeadline ( time . Now ( ) . Add ( 5 * time . Second ) ) reader := bufio . NewReader ( socket ) return http . ReadResponse ( reader , req ) }
RoundTrip dials the unix domain socket, sends the request and processes the
response.
RoundTrip dials the unix domain socket sends the request and processes the response .