Documentation
¶
Index ¶
Constants ¶
const MaxRetentionSize = 1024 * 50
MaxRetentionSize for responses. Mostly used by response.JSON. If the response body is less than this, it will be replaced with a bytes.Buffer containing the response if client.Response.ReadAll() and client.Response.JSON() are used. Obviously, directly accessing the response body will nullify any benefit from this.
Variables ¶
var DefaultUserAgent = "please/1.0 (compatible; ask nicely; http://git.destrealm.org/go/please)"
DefaultUserAgent with which to identify. Changing this value will modify the user-agent sent alongside all requests.
var ErrClientInitialization = errors.NewError("error initializing client")
ErrClientInitialization is raised by TLS-enabled clients whenever the assigned server certificate cannot be loaded or parsed.
var ErrClientRequest = errors.NewError("error in client with request setup or completion")
ErrClientRequest is raised whenever an error occurs during a client request.
var ErrEncoding = errors.NewError("error encoding data")
ErrEncoding is returned whenever an error occurs while encoding data, be it JSON or otherwise.
var ErrParsingQuery = errors.NewError("error parsing query string")
var ErrParsingURL = errors.NewError("error parsing URL")
ErrParsingURL is returned by the HTTP client if a given URL cannot be parsed.
var ErrRenderingURL = errors.NewError("unable to render URL")
var ErrVariableOffset = errors.NewError("variable offset exceeds template bounds")
Functions ¶
This section is empty.
Types ¶
type CodeHandler ¶
CodeHandler defines the function type to use for per-response or per-response code handlers.
type HeaderProxy ¶
type HeaderProxy interface { Proxy Err() error Write(io.Writer) HeaderProxy WriteSubset(io.Writer, map[string]bool) HeaderProxy }
type RequestProxy ¶
type Requester ¶
type Requester interface { Body(io.Reader) Requester Clone() Requester ChangeUserAgent(ua string) Requester Host(host string) Requester Method(method string) Requester To(method string) Requester Set(tplkey string, tplval string) Requester SetClient(client *http.Client) Requester SetURL(url string) Requester WriteJSON(data interface{}) Requester Get(paths ...string) Requester Delete(paths ...string) Requester Head(paths ...string) Requester Patch(paths ...string) Requester Post(paths ...string) Requester Put(paths ...string) Requester WithCertificatePath(path string) Requester WithTLS() Requester WithUnverifiedTLS() Requester WithContext(context.Context) Requester WithPath(paths ...string) Requester WithQuery(qs string) Requester Each(CodeHandler) Requester Client() *http.Client Err() error Headers() HeaderProxy Parent() Requester Form() Proxy Query() Proxy Prepare() (RequestProxy, error) Send() (Response, error) }