util

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2017 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorEncode

func ErrorEncode(decoded string) string

ErrorEncode encodes the error to a string conforming to RFC 6749.

RFC 6749 - The OAuth 2.0 Authorization Framework 5.2. Error Response https://tools.ietf.org/html/rfc6749#section-5.2

func ServeError

func ServeError(writer http.ResponseWriter, response Error, code int)

ServeError serves an error according to the given arguments.

func ServeErrorDefault

func ServeErrorDefault(writer http.ResponseWriter, code int)

ServeErrorDefault serves an error with the given status code and the default messages for the code.

func ServeJSON

func ServeJSON(writer http.ResponseWriter, data interface{}, code int)

ServeJSON writes given data in JSON.

func ServeMailError

func ServeMailError(writer http.ResponseWriter)

ServeMailError serves an error telling email failed.

Types

type Error

type Error struct {
	ID          string `json:"error,omitempty"`
	Description string `json:"error_description,omitempty"`
	URI         string `json:"error_uri,omitempty"`
}

Error is a structure to hold an error to serve.

The JSON-encoded structure is conforming to RFC 6749.

RFC 6749 - The OAuth 2.0 Authorization Framework 5.2. Error Response. https://tools.ietf.org/html/rfc6749#section-5.2

Jump to

Keyboard shortcuts

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