net

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2020 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package net provides common HTTP utilities.

Index

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 New

func New(customCABundle string) (*ACMENet, error)

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

func (c *ACMENet) GetRequest(url string) (*http.Request, error)

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) HeadURL

func (c *ACMENet) HeadURL(url string) (*http.Response, error)

func (*ACMENet) PostRequest

func (c *ACMENet) PostRequest(url string, body []byte) (*http.Request, error)

Convenience function to construct a POST request to the given URL with the given body. Returns an HTTP request or a non-nil error.

func (*ACMENet) PostURL

func (c *ACMENet) PostURL(url string, body []byte) (*NetResponse, error)

Convenience function to POST the given URL with the given body. This is a wrapper combining PostRequest and Do.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL