handlers

package
v0.0.0-...-957a2cb Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJSON        = "application/json"
	ContentTypeHTML        = "text/html"
	ContentTypeText        = "text/plain"
	ContentTypeXML         = "text/xml"
	ContentTypeCSS         = "text/css"
	ContentTypeJS          = "application/javascript"
	ContentTypeForm        = "application/x-www-form-urlencoded"
	ContentTypeMultipart   = "multipart/form-data"
	ContentTypeOctetStream = "application/octet-stream"
)

Variables

This section is empty.

Functions

func Make

Types

type HTTPErrorHandler

type HTTPErrorHandler func(hc HandlerContext, err error)

type HTTPHandler

type HTTPHandler func(hc HandlerContext) error

type HandlerContext

type HandlerContext interface {
	Request() *http.Request
	SetRequest(*http.Request)
	Response() http.ResponseWriter
	SetResponse(http.ResponseWriter)
	Get(string) interface{}
	Set(string, interface{})
	Delete(string)
	QueryParams() url.Values
	QueryParam(string) string
	QueryString() string
	JSON(code int, v interface{}) error
	Render(templ.Component) error

	Redirect(code int, url string)
	Getenv(key string, defaults ...string) string
	URLParam(string) string
	// contains filtered or unexported methods
}

func NewHandlerContext

func NewHandlerContext(w http.ResponseWriter, r *http.Request) HandlerContext

type Map

type Map map[string]interface{}

Jump to

Keyboard shortcuts

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