http

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

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

func HttpRouteMatch

func HttpRouteMatch(c *HttpContext, rm model.RouterMatch) bool

HttpRouteMatch

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) AddHeader

func (hc *HttpContext) AddHeader(k, v string)

AddHeader add header

func (*HttpContext) AllHeaders

func (hc *HttpContext) AllHeaders() http.Header

AllHeaders get all headers

func (*HttpContext) Api

func (hc *HttpContext) Api(api *api.API)

Api wait do delete

func (*HttpContext) BuildFilters

func (hc *HttpContext) BuildFilters()

BuildFilters build filter, from config http_filters

func (*HttpContext) GetAPI

func (hc *HttpContext) GetAPI() *router.API

GetAPI get api

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) GetUrl

func (hc *HttpContext) GetUrl() string

GetUrl get http request url

func (*HttpContext) Next

func (hc *HttpContext) Next()

Next logic for lookup filter

func (*HttpContext) Reset

func (hc *HttpContext) Reset()

Reset reset http context

func (*HttpContext) ResetWritermen

func (hc *HttpContext) ResetWritermen(w http.ResponseWriter)

ResetWritermen reset writermen

func (*HttpContext) Status

func (hc *HttpContext) Status(code int)

Status set header status code

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) WriteErr

func (hc *HttpContext) WriteErr(p interface{})

WriteErr

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) WriteSuccess

func (hc *HttpContext) WriteSuccess()

WriteSuccess

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 ...

Jump to

Keyboard shortcuts

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