internal

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorHandlerContextKey ctxKey = 1

ErrorHandlerContextKey is used to store an ErrorHandler in the context.

Functions

func DecodeGet

func DecodeGet(r *http.Request, ret interface{}) error

DecodeGet parses the GET parameters of the request into `ret` using github.com/gorilla/schema.

func DecodePost

func DecodePost(r *http.Request, ret interface{}) error

DecodePost parses the POST parameters of the request into `ret` using github.com/gorilla/schema.

func DoRespond

func DoRespond(w http.ResponseWriter, r *http.Request, hr HttpResponse)

DoRespond executes a HttpResponse and has it write to the ResponseWriter.

Types

type ErrorHandler

type ErrorHandler func(code int, msg string, r *http.Request) HttpResponse

ErrorHandler is a callback type that you can register with ContextWithErrorHandler or WithErrorHandler to have your own callback called to render errors.

type HttpResponse

type HttpResponse interface {
	Respond(w http.ResponseWriter, r *http.Request) error
}

HttpResponse is what is to be returned from request handlers. Respond gets executed to write the response to the client.

Jump to

Keyboard shortcuts

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