web

package
v0.0.0-...-27722f5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package web defines helper routines for accessing HTTP/HTTPS resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(url string) ([]byte, error)

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 OpenBrowser(url string) bool

func QueryEscape

func QueryEscape(s string) string

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	// contains filtered or unexported fields
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

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
)

Jump to

Keyboard shortcuts

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