Documentation ¶
Overview ¶
Package webutil is for working with the web at a higher level of abstraction than net/http and such.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attr ¶
Attr returns the value of the first attribute named name and a boolean indicating whether any was found.
func GetBytes ¶
GetBytes returns a slice of bytes containing the response body. It returns an error on any non-200 response.
func GetHTML ¶
GetHTML returns the parsed HTML response body as a (pointer to) a go.net/html.Node. It returns an error on any non-200 response.
func GetReadCloser ¶
func GetReadCloser(url string) (io.ReadCloser, error)
GetReadCloser returns the response body as an io.ReadCloser. The caller is responsible for closing it. GetReadCloser returns an error on any non-200 response.
Types ¶
type HTTPError ¶
HTTPError represents an undesired HTTP response. It is usually used by functions that want to return an error on non-200 responses.
func NewHTTPError ¶
NewHTTPError constructs an HTTPError from the provided http.Response.