示例#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
}
示例#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)
}