api

package
v0.0.0-...-af59c4b Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(response http.ResponseWriter) error

func Forbidden

func Forbidden(response http.ResponseWriter) error

func ForkSessionContext

func ForkSessionContext(ctx context.Context, id string) context.Context

func GetHTTPErrorStatusCode

func GetHTTPErrorStatusCode(err error) int

func MakeErrorHandler

func MakeErrorHandler(err error) http.HandlerFunc

func NotFound

func NotFound(response http.ResponseWriter) error

func ReadJSON

func ReadJSON(request *http.Request, v interface{}) error

ReadJSON from the request into the given object

func SessionIdFromContext

func SessionIdFromContext(ctx context.Context) (string, error)

func SuccessEmpty

func SuccessEmpty(response http.ResponseWriter) error

func SuccessOK

func SuccessOK(response http.ResponseWriter) error

func Unauthorized

func Unauthorized(response http.ResponseWriter) error

func WriteJSON

func WriteJSON(response http.ResponseWriter, statusCode int, v interface{}) error

WriteJSON writes the value v to the http response stream as json with standard json encoding.

Types

type Function

type Function func(ctx context.Context, response http.ResponseWriter, request *http.Request, variables map[string]string) error

Function is an adapter to allow the use of ordinary functions as API endpoints.

type Session

type Session struct{}

Jump to

Keyboard shortcuts

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