context

package
v0.0.0-...-16d05a1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerContext

type HandlerContext struct {
	Res  http.ResponseWriter
	Req  *http.Request
	Sess models.Session
}

HandlerContext holds SessionHandlerFunc required attributes for a handler function

func (*HandlerContext) ReadJSON

func (c *HandlerContext) ReadJSON(target interface{}) error

ReadJSON reads the request body as json into the given target and returns an error with what went wrong it might fail if the target isn't a pointer, or if the body isn't a proper JSON

func (*HandlerContext) WriteJSON

func (c *HandlerContext) WriteJSON(src interface{}, failStatus int) error

WriteJSON writes the given object into the http response

Jump to

Keyboard shortcuts

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