Help us shape the future of Go! Take the 2026 Go Developer Survey

render

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidToken is returned when the api request token is invalid.
	ErrInvalidToken = errors.New("Invalid or missing token")

	// ErrUnauthorized is returned when the user is not authorized.
	ErrUnauthorized = errors.New("Unauthorized")

	// ErrForbidden is returned when user access is forbidden.
	ErrForbidden = errors.New("Forbidden")

	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = errors.New("Not Found")

	// ErrNotImplemented is returned when an endpoint is not implemented.
	ErrNotImplemented = errors.New("Not Implemented")
)

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, err error)

BadRequest writes the json-encoded error message to the response with a 400 bad request status code.

func BadRequestf

func BadRequestf(w http.ResponseWriter, format string, a ...interface{})

BadRequestf writes the json-encoded error message to the response with a 400 bad request status code.

func ErrorCode

func ErrorCode(w http.ResponseWriter, err error, status int)

ErrorCode writes the json-encoded error message to the response.

func Forbidden

func Forbidden(w http.ResponseWriter, err error)

Forbidden writes the json-encoded error message to the response with a 403 forbidden status code.

func InternalError

func InternalError(w http.ResponseWriter, err error)

InternalError writes the json-encoded error message to the response with a 500 internal server error.

func InternalErrorf

func InternalErrorf(w http.ResponseWriter, format string, a ...interface{})

InternalErrorf writes the json-encoded error message to the response with a 500 internal server error.

func JSON

func JSON(w http.ResponseWriter, v interface{}, status int)

JSON writes the json-encoded error message to the response with a 400 bad request status code.

func NotFound

func NotFound(w http.ResponseWriter, err error)

NotFound writes the json-encoded error message to the response with a 404 not found status code.

func NotFoundf

func NotFoundf(w http.ResponseWriter, format string, a ...interface{})

NotFoundf writes the json-encoded error message to the response with a 404 not found status code.

func NotImplemented

func NotImplemented(w http.ResponseWriter, err error)

NotImplemented writes the json-encoded error message to the response with a 501 not found status code.

func Unauthorized

func Unauthorized(w http.ResponseWriter, err error)

Unauthorized writes the json-encoded error message to the response with a 401 unauthorized status code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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