Back to

Package web

Latest Go to latest

The latest major version is .

Published: Jan 12, 2020 | License: CC0-1.0 | Module:


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


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.

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier