http

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

Types

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response `json:",omitempty"`
	Body     []byte
}

An ErrorResponse reports errors caused by an API request.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Directories

Path Synopsis
Package render implements template inheritance and exposes functions to render HTML.
Package render implements template inheritance and exposes functions to render HTML.

Jump to

Keyboard shortcuts

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