http

package
v0.0.0-...-4aff305 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: GPL-3.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error is a HTTP error type that allows the sending of errors correctly.

func NewError

func NewError(logger log.Logger) Error

NewError creates a new Error with a logger.

func (Error) BadRequest

func (e Error) BadRequest(w http.ResponseWriter, r *http.Request, err string)

BadRequest to the request with an HTTP 400 bad request error.

func (Error) Error

func (e Error) Error(w http.ResponseWriter, err string, code int)

Error replies to the request with the specified error message and HTTP code. It does not otherwise end the request; the caller should ensure no further writes are done to w. The error message should be application/json.

func (Error) InternalServerError

func (e Error) InternalServerError(w http.ResponseWriter, r *http.Request, err string)

InternalServerError to the request with an HTTP 500 bad request error.

func (Error) NotFound

func (e Error) NotFound(w http.ResponseWriter, r *http.Request)

NotFound replies to the request with an HTTP 404 not found error.

Jump to

Keyboard shortcuts

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