Documentation
¶
Overview ¶
Package httphelper implements NewRequest, Do, DoRequest from a requestfactory.T and http.client
Index ¶
- Constants
- func NewHttpsClient(insecure bool) *http.Client
- type PhaseError
- type T
- func (t *T) Do(req *http.Request) (*http.Response, error)
- func (t *T) DoRequest(method string, relPath string, body io.Reader) (*http.Response, error)
- func (t *T) NewRequest(method string, relPath string, body io.Reader) (*http.Request, error)
- func (t *T) NewRequestWithContext(ctx context.Context, method string, relPath string, body io.Reader) (*http.Request, error)
- func (t *T) URL() string
Constants ¶
const ( PhaseResolve = "resolving the host name" PhaseConnect = "connecting" PhaseTLS = "negotiating tls" PhaseSend = "sending the request" PhaseAnswer = "waiting for the answer" )
Phases of a request, the one it was in when it failed.
Variables ¶
This section is empty.
Functions ¶
func NewHttpsClient ¶
NewHttpsClient returns a client of the transport of the nodes, its connect and its TLS handshake bounded, verifying the certificate of the server unless insecure.
The transport is shared by the clients: a request reuses the connection of the previous ones. A request with no connection by half the time its context leaves it, nothing sent, is sent again once, and a request failing says the phase it was in, as a PhaseError.
Types ¶
type PhaseError ¶
PhaseError is the error of a request, with the phase it was in.
func (*PhaseError) Error ¶
func (e *PhaseError) Error() string
func (*PhaseError) Unwrap ¶
func (e *PhaseError) Unwrap() error
type T ¶
type T struct {
// contains filtered or unexported fields
}