httputils

package
v0.0.0-...-e6e6c42 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolValue

func BoolValue(r *http.Request, k string) bool

BoolValue transforms a form value in different formats into a boolean type.

Types

type HTTPError

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

HTTPError represents an HTTP error which contains potential status code. For API layer, daemon side should return error message and using correct status code to construct response when an error happens in handling requests.

func NewHTTPError

func NewHTTPError(err error, code int) HTTPError

NewHTTPError returns a brand new HTTPError with input message and status code

func (HTTPError) Code

func (err HTTPError) Code() int

Code returns status code field of HTTPError

func (HTTPError) Error

func (err HTTPError) Error() string

Error returns Message field of HTTPError

Jump to

Keyboard shortcuts

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