Example #1
0
func (o *Outbound) getHTTPClient(peer *hostport.Peer) (*http.Client, error) {
	agent, ok := peer.Agent().(*Agent)
	if !ok {
		return nil, terrors.ErrInvalidAgentConversion{
			Agent:        peer.Agent(),
			ExpectedType: "*http.Agent",
		}
	}
	return agent.client, nil
}
Example #2
0
func (o *Outbound) createRequest(peer *hostport.Peer, treq *transport.Request) (*http.Request, error) {
	newURL := *o.urlTemplate
	newURL.Host = peer.HostPort()
	return http.NewRequest("POST", newURL.String(), treq.Body)
}