api

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IgnoredFormFields []string

IgnoredFormFields are ignored by FormValues() when checking for extraneous fields

View Source
var Log = func(*http.Request, *Response, error) {}

Log allows logging of events and errors

View Source
var ResponseHeaders map[string]string

ResponseHeaders are returned with each response

View Source
var TraceEnabled = false

TraceEnabled Attaches a trace field to the JSON response when enabled.

Functions

func FormValues

func FormValues(r *http.Request, params interface{}, validationRules []*v.FieldRules) error

Types

type Handler

type Handler func(r *http.Request) Response

Handler handles API requests

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Response

type Response struct {
	Status      int
	Data        interface{}
	RedirectURL string
	Error       error
}

Response is returned by API handlers

type StatusError

type StatusError struct {
	Status int
	Err    error
}

StatusError represents an error with an associated HTTP status code.

func (StatusError) Error

func (se StatusError) Error() string

Jump to

Keyboard shortcuts

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