package web
import "cmd/go/internal/web"
Package web defines helper routines for accessing HTTP/HTTPS resources.
Index ¶
- func Get(url string) ([]byte, error)
- func GetMaybeInsecure(importPath string, security SecurityMode) (urlStr string, body io.ReadCloser, err error)
- func OpenBrowser(url string) bool
- func QueryEscape(s string) string
- type HTTPError
- type SecurityMode
Functions ¶
func Get ¶
Get returns the data from an HTTP GET request for the given URL.
func GetMaybeInsecure ¶
func GetMaybeInsecure(importPath string, security SecurityMode) (urlStr string, body io.ReadCloser, err error)
GetMaybeInsecure returns the body of either the importPath's https resource or, if unavailable and permitted by the security mode, the http resource.
func OpenBrowser ¶
func QueryEscape ¶
Types ¶
type HTTPError ¶
type HTTPError struct { StatusCode int // contains filtered or unexported fields }
func (*HTTPError) Error ¶
type SecurityMode ¶
type SecurityMode int
SecurityMode specifies whether a function should make network calls using insecure transports (eg, plain text HTTP). The zero value is "secure".
const ( Secure SecurityMode = iota Insecure )
Source Files ¶
- Version
- v1.9.7
- Published
- Jun 6, 2018
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 56 seconds ago –
Tools for package owners.