httputils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2017 License: Apache-2.0 Imports: 7 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeleteRoute

func NewDeleteRoute(
	name, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewDeleteRoute initializes a new route with the http method DELETE.

func NewGetRoute

func NewGetRoute(
	name, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewGetRoute initializes a new route with the http method GET.

func NewHeadRoute

func NewHeadRoute(
	name, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewHeadRoute initializes a new route with the http method HEAD.

func NewOptionsRoute

func NewOptionsRoute(
	name, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewOptionsRoute initializes a new route with the http method OPTIONS

func NewPostRoute

func NewPostRoute(
	name, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewPostRoute initializes a new route with the http method POST.

func NewPutRoute

func NewPutRoute(
	name, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewPutRoute initializes a new route with the http method PUT.

func NewRoute

func NewRoute(
	name, method, path string,
	handler types.APIFunc,
	middlewares ...types.Middleware) types.Route

NewRoute initialies a new local route for the reouter

func WriteData

func WriteData(w http.ResponseWriter, code int, v []byte) error

WriteData writes the value v to the http response stream as binary.

func WriteJSON

func WriteJSON(w http.ResponseWriter, code int, v interface{}) error

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

func WriteResponse

func WriteResponse(w http.ResponseWriter, rec *httptest.ResponseRecorder)

WriteResponse writes a recorded response to a ResponseWriter.

func WriteTask

func WriteTask(
	ctx types.Context,
	config gofig.Config,
	w http.ResponseWriter,
	store types.Store,
	task *types.Task,
	okStatus int) error

WriteTask writes a task to a ResponseWriter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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