web

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2019 License: CC0-1.0 Imports: 9 Imported by: 0

Documentation

Overview

Package web is a simple collection of high-level error and transport types that I end up using over and over.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUserAgent

func GenUserAgent() string

GenUserAgent creates a unique User-Agent string for outgoing HTTP requests.

func NewError

func NewError(wantStatusCode int, resp *http.Response) error

NewError creates an Error based on an expected HTTP status code vs data populated from an HTTP response.

This consumes the body of the HTTP response.

Types

type Error

type Error struct {
	WantStatus, GotStatus int
	URL                   *url.URL
	Method                string
	ResponseBody          string
}

Error is a web response error. Use this when API calls don't work out like you wanted them to.

func (Error) Error

func (e Error) Error() string

func (Error) F

func (e Error) F() ln.F

F ields for logging.

Directories

Path Synopsis
Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.
Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.
Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.
Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.
Package tokipana wraps http://inamidst.com/services/tokipana.
Package tokipana wraps http://inamidst.com/services/tokipana.
Package tokiponatokens is a wrapper to a Toki Poka tokenizer.
Package tokiponatokens is a wrapper to a Toki Poka tokenizer.

Jump to

Keyboard shortcuts

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