Documentation
¶
Overview ¶
Package network retrieves resources for the Growse browser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrResponseTooLarge = errors.New("response body is too large") ErrResponseTruncated = errors.New("response body was truncated") ErrRedirectLoop = errors.New("redirect loop") ErrRedirectLimit = errors.New("redirect limit exceeded") ErrTimeout = errors.New("request timed out") ErrRequestTooLarge = errors.New("request exceeds safety limit") ErrHeadersTooLarge = errors.New("HTTP headers exceed safety limit") )
ErrResponseTooLarge is returned when a response exceeds the configured body-size limit.
var ( ErrCORS = errors.New("CORS policy rejected the response") ErrCORSPreflightRequired = errors.New("CORS preflight is required") )
var ErrInvalidOrigin = errors.New("invalid HTTP origin")
ErrInvalidOrigin reports a URL that cannot identify an HTTP(S) origin.
Functions ¶
func RedactedURL ¶ added in v0.8.0
RedactedURL removes userinfo before a URL is included in UI or errors.
func SameOrigin ¶ added in v0.8.0
SameOrigin reports whether two URLs share scheme, host, and effective port.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a size-limited HTTP resource loader.
func NewClientWithLimits ¶
NewClientWithLimits creates a client with explicit dependencies and limits. It is primarily useful for tests and alternative transports.
type CredentialsMode ¶ added in v0.8.0
type CredentialsMode string
CredentialsMode controls whether Fetch sends and stores credentials.
const ( CredentialsOmit CredentialsMode = "omit" CredentialsSameOrigin CredentialsMode = "same-origin" CredentialsInclude CredentialsMode = "include" )
type Origin ¶ added in v0.8.0
Origin is the scheme, host, and effective port security boundary of a URL.
func OriginFromURL ¶ added in v0.8.0
OriginFromURL returns the normalized HTTP(S) origin of target.
type Request ¶ added in v0.8.0
type Request struct {
Method string
URL *url.URL
Header http.Header
Body []byte
SiteURL *url.URL
Kind RequestKind
Credentials CredentialsMode
}
Request contains the HTTP request data accepted by the network client.
type RequestKind ¶ added in v0.8.0
type RequestKind uint8
RequestKind identifies the browser operation that initiated a request.
const ( RequestSubresource RequestForm RequestFetch )