Documentation ¶
Overview ¶
Package net provides common HTTP utilities.
Index ¶
- type ACMENet
- func (c *ACMENet) Do(req *http.Request) (*NetResponse, error)
- func (c *ACMENet) GetRequest(url string) (*http.Request, error)
- func (c *ACMENet) GetURL(url string) (*NetResponse, error)
- func (c *ACMENet) HeadURL(url string) (*http.Response, error)
- func (c *ACMENet) PostRequest(url string, body []byte) (*http.Request, error)
- func (c *ACMENet) PostURL(url string, body []byte) (*NetResponse, error)
- type NetResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACMENet ¶
type ACMENet struct {
// contains filtered or unexported fields
}
func (*ACMENet) Do ¶
func (c *ACMENet) Do(req *http.Request) (*NetResponse, error)
Do performs an HTTP request, returning a pointer to a NetResponse instance or an error. User-Agent and Accept-Language headers are automatically added. to the request. The body of the HTTP Response is read into the NetResponse and can not be read again.
func (*ACMENet) GetRequest ¶
Convenience function to construct a GET request to the given URL. Returns an HTTP request or a non-nil error.
func (*ACMENet) GetURL ¶
func (c *ACMENet) GetURL(url string) (*NetResponse, error)
Convenience function to GET the given URL. This is a wrapper combining GetRequest and Do.
func (*ACMENet) PostRequest ¶
Convenience function to construct a POST request to the given URL with the given body. Returns an HTTP request or a non-nil error.
type NetResponse ¶
type NetResponse struct { // The HTTP Response object from making the request. Response *http.Response // The response body. RespBody []byte // The response dumped by httputil to a printable form. RespDump []byte // The request dumped by httputil to a printable form. ReqDump []byte }
NetResponse holds the results from calling Do with an HTTP Request.