http

package
v0.5.0-rc01 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrResponse

type ErrResponse struct {
	Message string `json:"message"`
}

ErrResponse err response.

type FilterChain

type FilterChain []FilterFunc

FilterChain filter chain

type FilterFunc

type FilterFunc func(c *HttpContext)

FilterFunc filter func, filter

type HttpContext

type HttpContext struct {
	//Deprecated: waiting to delete
	Index int8
	//Deprecated: waiting to delete
	Filters FilterChain
	Timeout time.Duration
	Ctx     context.Context
	Params  map[string]interface{}

	// the response context will return.
	TargetResp *client.Response
	// client call response.
	SourceResp interface{}

	HttpConnectionManager model.HttpConnectionManagerConfig
	Route                 *model.RouteAction
	Api                   *router.API

	Request *http.Request
	Writer  http.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) Abort deprecated

func (hc *HttpContext) Abort()

Deprecated: Abort filter chain break , filter after the current filter will not executed.

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) AppendFilterFunc deprecated

func (hc *HttpContext) AppendFilterFunc(ff ...FilterFunc)

Deprecated: AppendFilterFunc append filter func.

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

func (hc *HttpContext) GetLocalReplyBody() []byte

func (*HttpContext) GetMethod

func (hc *HttpContext) GetMethod() string

GetMethod get method, POST/GET ...

func (*HttpContext) GetRouteEntry

func (hc *HttpContext) GetRouteEntry() *model.RouteAction

GetRouteEntry get route

func (*HttpContext) GetStatusCode

func (hc *HttpContext) GetStatusCode() int

func (*HttpContext) GetUrl

func (hc *HttpContext) GetUrl() string

GetUrl get http request url

func (*HttpContext) LocalReply

func (hc *HttpContext) LocalReply() bool

func (*HttpContext) Next deprecated

func (hc *HttpContext) Next()

Deprecated: Next logic for lookup filter

func (*HttpContext) Reset

func (hc *HttpContext) Reset()

Reset reset http context

func (*HttpContext) RouteEntry

func (hc *HttpContext) RouteEntry(r *model.RouteAction)

RouteEntry set route

func (*HttpContext) SendLocalReply

func (hc *HttpContext) SendLocalReply(status int, body []byte)

SendLocalReply Means that the request was interrupted and Response will be sent directly Even if it’s currently in to Decode stage

func (*HttpContext) SetUrl

func (hc *HttpContext) SetUrl(url string)

func (*HttpContext) StatusCode

func (hc *HttpContext) StatusCode(code int)

Jump to

Keyboard shortcuts

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