ephook

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Head(w http.ResponseWriter, r *http.Request, out interface{})

Head is a response hook that checks has a Head method that wants full control over the response headers before the first output is encoded.

func NewStandardError

func NewStandardError(logs *log.Logger) func(err error) interface{}

NewStandardError creates an error hook for handling ep.Error errors. It logs errors to the provided logger creates sensible status codes and only revels standard HTTP text that is associated with that code. It comes with default outputs for the XML, JSON and HTML encoders.

func Read

func Read(r *http.Request, in interface{}) error

Read is a request hook that checks if the input has a Read method with full control over reading the request for each input that is decoded.

func Redirect

func Redirect(w http.ResponseWriter, r *http.Request, out interface{})

Redirect is a response hook will check if the output implements a Redirect method to return a non-empty string as a location to redirect to. If the output also implements status it is called to determine the status code to use for redirection.

func Status

func Status(w http.ResponseWriter, r *http.Request, out interface{})

Status is a response hook will assert if the out interface has a status method and if it has, write the header with that status

Types

This section is empty.

Jump to

Keyboard shortcuts

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