Documentation ¶
Index ¶
- func AssertHead(value string, assert func(head string) bool) (passed bool)
- func HasPrefix(value string, prefix string) bool
- func MarshalAndWriteJSON(responseWriter http.ResponseWriter, value interface{}) (err error)
- func MatchHead(value string, head string) (matched bool)
- func RenderAndWriteHTMLNode(responseWriter http.ResponseWriter, node *html.Node) (err error)
- func ShiftAndAssertHead(value string, assert func(head string) bool) (passed bool, tail string)
- func ShiftAndMatchHead(value string, head string) (matched bool, tail string)
- func ShiftHead(value string) (head, tail string)
- func Write(responseWriter http.ResponseWriter, contentType string, contentLength int, ...)
- func WriteFile(responseWriter http.ResponseWriter, contentType string, data []byte)
- func WriteHTML(responseWriter http.ResponseWriter, html []byte)
- func WriteJSON(responseWriter http.ResponseWriter, json []byte)
- func WriteText(responseWriter http.ResponseWriter, text []byte)
- func WriteXML(responseWriter http.ResponseWriter, xml []byte)
- type ContextValues
- type ErrorHandler
- type Filter
- type Handler
- type Middleware
- type OnWrite
- type ResponseMethods
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalAndWriteJSON ¶
func MarshalAndWriteJSON(responseWriter http.ResponseWriter, value interface{}) (err error)
func RenderAndWriteHTMLNode ¶
func RenderAndWriteHTMLNode(responseWriter http.ResponseWriter, node *html.Node) (err error)
func ShiftAndAssertHead ¶
func ShiftAndMatchHead ¶
func Write ¶ added in v0.0.14
func Write( responseWriter http.ResponseWriter, contentType string, contentLength int, data []byte, )
func WriteFile ¶
func WriteFile(responseWriter http.ResponseWriter, contentType string, data []byte)
func WriteHTML ¶
func WriteHTML(responseWriter http.ResponseWriter, html []byte)
func WriteJSON ¶
func WriteJSON(responseWriter http.ResponseWriter, json []byte)
func WriteText ¶ added in v0.0.14
func WriteText(responseWriter http.ResponseWriter, text []byte)
func WriteXML ¶ added in v0.0.14
func WriteXML(responseWriter http.ResponseWriter, xml []byte)
Types ¶
type ContextValues ¶
type ContextValues interface { Get(key interface{}) interface{} Set(key, value interface{}) Del(key interface{}) }
type ErrorHandler ¶
type ErrorHandler func(Server, http.ResponseWriter, *http.Request, interface{})
type Middleware ¶
type ResponseMethods ¶
type ResponseMethods interface { Write( responseWriter http.ResponseWriter, request *http.Request, contentType string, contentLength int, data []byte, ) WriteText(responseWriter http.ResponseWriter, request *http.Request, text []byte) WriteHTML(responseWriter http.ResponseWriter, request *http.Request, html []byte) WriteJSON(responseWriter http.ResponseWriter, request *http.Request, json []byte) WriteXML(responseWriter http.ResponseWriter, request *http.Request, xml []byte) OnWrite(onWrite OnWrite) }
type Server ¶
type Server interface { http.Handler ResponseMethods SetHandler(handler Handler) Server SetErrorHandler(errorHandler ErrorHandler) Server // // Context returns the base context.Context. // // // // This context is propagated to all sub-servers and its // Context() context.Context // SetContext(context context.Context) Server ContextValues() ContextValues AddFilters(filters ...Filter) Server AddMiddlewares(middlewares ...Middleware) Server // Match checks whether incoming *http.Request should be handled // by this server's handler. // // Match function will test request against all filters associated // with this server. If the request doesn't pass any one of them, // the Match function will return false. Otherwise, by default, // the Match function will return true. Match(request *http.Request) bool HandleError(responseWriter http.ResponseWriter, request *http.Request, err interface{}) }
Click to show internal directories.
Click to hide internal directories.