Documentation ¶
Index ¶
- func HttpHeaderMatch(c *HttpContext, hm model.HeaderMatcher) bool
- func HttpRouteActionMatch(c *HttpContext, ra model.RouteAction) bool
- func HttpRouteMatch(c *HttpContext, rm model.RouterMatch) bool
- type HttpContext
- func (hc *HttpContext) API(api router.API)
- func (hc *HttpContext) AddHeader(k, v string)
- func (hc *HttpContext) AllHeaders() http.Header
- func (hc *HttpContext) Api(api *api.API)
- func (hc *HttpContext) BuildFilters()
- func (hc *HttpContext) GetAPI() *router.API
- func (hc *HttpContext) GetApplicationName() string
- func (hc *HttpContext) GetClientIP() string
- func (hc *HttpContext) GetHeader(k string) string
- func (hc *HttpContext) GetMethod() string
- func (hc *HttpContext) GetUrl() string
- func (hc *HttpContext) Next()
- func (hc *HttpContext) Reset()
- func (hc *HttpContext) ResetWritermen(w http.ResponseWriter)
- func (hc *HttpContext) Status(code int)
- func (hc *HttpContext) StatusCode() int
- func (hc *HttpContext) Write(b []byte) (int, error)
- func (hc *HttpContext) WriteErr(p interface{})
- func (hc *HttpContext) WriteHeaderNow()
- func (hc *HttpContext) WriteJSONWithStatus(code int, res interface{})
- func (hc *HttpContext) WriteResponse(resp client.Response)
- func (hc *HttpContext) WriteSuccess()
- func (hc *HttpContext) WriteWithStatus(code int, b []byte) (int, error)
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpHeaderMatch ¶
func HttpHeaderMatch(c *HttpContext, hm model.HeaderMatcher) bool
HttpHeaderMatch
func HttpRouteActionMatch ¶
func HttpRouteActionMatch(c *HttpContext, ra model.RouteAction) bool
HttpRouteActionMatch
Types ¶
type HttpContext ¶
type HttpContext struct { *context.BaseContext HttpConnectionManager model.HttpConnectionManager FilterChains []model.FilterChain Listener *model.Listener Request *http.Request Writer ResponseWriter // contains filtered or unexported fields }
HttpContext http context
func (*HttpContext) API ¶
func (hc *HttpContext) API(api router.API)
API sets the API to http context
func (*HttpContext) AllHeaders ¶
func (hc *HttpContext) AllHeaders() http.Header
AllHeaders get all headers
func (*HttpContext) BuildFilters ¶
func (hc *HttpContext) BuildFilters()
BuildFilters build filter, from config http_filters
func (*HttpContext) GetApplicationName ¶
func (hc *HttpContext) GetApplicationName() string
GetApplicationName get application name
func (*HttpContext) GetClientIP ¶
func (hc *HttpContext) GetClientIP() string
GetClientIP get client IP
func (*HttpContext) GetHeader ¶
func (hc *HttpContext) GetHeader(k string) string
GetHeader get header
func (*HttpContext) GetMethod ¶
func (hc *HttpContext) GetMethod() string
GetMethod get method, POST/GET ...
func (*HttpContext) ResetWritermen ¶
func (hc *HttpContext) ResetWritermen(w http.ResponseWriter)
ResetWritermen reset writermen
func (*HttpContext) StatusCode ¶
func (hc *HttpContext) StatusCode() int
StatusCode get header status code
func (*HttpContext) Write ¶
func (hc *HttpContext) Write(b []byte) (int, error)
Write write body data
func (*HttpContext) WriteHeaderNow ¶
func (hc *HttpContext) WriteHeaderNow()
WriteHeaderNow write header now
func (*HttpContext) WriteJSONWithStatus ¶
func (hc *HttpContext) WriteJSONWithStatus(code int, res interface{})
WriteJSONWithStatus write fail, auto add context-type json.
func (*HttpContext) WriteResponse ¶
func (hc *HttpContext) WriteResponse(resp client.Response)
WriteResponse
func (*HttpContext) WriteWithStatus ¶
func (hc *HttpContext) WriteWithStatus(code int, b []byte) (int, error)
WriteWithStatus status must set first
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter http.Hijacker http.Flusher // todo replace it later version // nolint http.CloseNotifier // Returns the HTTP response status code of the current request. Status() int // Returns the number of bytes already written into the response http body. // See Written() Size() int // Writes the string into the response body. WriteString(string) (int, error) // Returns true if the response body was already written. Written() bool // Forces to write the http header (status code + headers). WriteHeaderNow() // get the http.Pusher for server push Pusher() http.Pusher }
ResponseWriter ...
Click to show internal directories.
Click to hide internal directories.