Documentation ¶
Index ¶
- Variables
- func DoHttpFilter(httpFilter HttpFilter, ctx eocontext.EoContext, next eocontext.IChain) (err error)
- type FileHeader
- type HttpFilter
- type IBodyDataReader
- type IBodyDataWriter
- type IBodyGet
- type IBodySet
- type IHeaderReader
- type IHeaderWriter
- type IHttpContext
- type IQueryReader
- type IQueryWriter
- type IRequest
- type IRequestReader
- type IResponse
- type IResponseHeader
- type IStatusGet
- type IStatusSet
- type IURIReader
- type IURIWriter
- type IWebsocketContext
- type WebsocketFilter
Constants ¶
This section is empty.
Variables ¶
View Source
var (
FilterSkillName = config.TypeNameOf((*HttpFilter)(nil))
)
Functions ¶
func DoHttpFilter ¶
Types ¶
type FileHeader ¶
type FileHeader struct { FileName string Header textproto.MIMEHeader Data []byte }
type HttpFilter ¶
type HttpFilter interface {
DoHttpFilter(ctx IHttpContext, next eocontext.IChain) (err error)
}
type IBodyDataReader ¶
type IBodyDataReader interface { //protocol() RequestType ContentType() string //content-Type = application/x-www-form-urlencoded 或 multipart/form-data,与原生request.Form不同,这里不包括 query 参数 BodyForm() (url.Values, error) //content-Type = multipart/form-data 时有效 Files() (map[string][]*multipart.FileHeader, error) GetForm(key string) string GetFile(key string) (file []*multipart.FileHeader, has bool) RawBody() ([]byte, error) }
type IBodyDataWriter ¶
type IBodyDataWriter interface { IBodyDataReader //设置form数据并将content-type设置 为 application/x-www-form-urlencoded 或 multipart/form-data SetForm(values url.Values) error SetToForm(key, value string) error AddForm(key, value string) error // 会替换掉对应掉file信息,并且将content-type 设置为 multipart/form-data AddFile(key string, file *multipart.FileHeader) error //设置 multipartForm 数据并将content-type设置 为 multipart/form-data // 重置body,会清除掉未处理掉 form和file SetRaw(contentType string, body []byte) }
type IHeaderReader ¶
type IHeaderWriter ¶
type IHeaderWriter interface { IHeaderReader SetHeader(key, value string) AddHeader(key, value string) DelHeader(key string) SetHost(host string) }
type IHttpContext ¶
type IQueryReader ¶
type IQueryWriter ¶
type IQueryWriter interface { IQueryReader SetQuery(key, value string) AddQuery(key, value string) DelQuery(key string) SetRawQuery(raw string) }
type IRequest ¶
type IRequest interface { Method() string Header() IHeaderWriter Body() IBodyDataWriter URI() IURIWriter SetMethod(method string) }
用于组装转发的request
type IRequestReader ¶
type IRequestReader interface { Header() IHeaderReader Body() IBodyDataReader RemoteAddr() string RemotePort() string ReadIP() string ForwardIP() string URI() IURIReader Method() string String() string }
原始请求数据的读
type IResponse ¶
type IResponse interface { ResponseError() error ClearError() String() string IStatusGet IResponseHeader IStatusSet // 设置返回状态 IBodySet // 设置返回内容 IBodyGet }
返回给client端的
type IResponseHeader ¶
type IStatusGet ¶
type IStatusSet ¶
type IURIReader ¶
type IURIWriter ¶
type IURIWriter interface { IURIReader IQueryWriter //SetRequestURI(uri string) SetPath(string) SetScheme(scheme string) SetHost(host string) }
type IWebsocketContext ¶ added in v0.8.0
type IWebsocketContext interface { IHttpContext Upgrade() error SetUpstreamConn(conn *websocket.Conn) IsWebsocket() bool }
func WebsocketAssert ¶ added in v0.8.0
func WebsocketAssert(ctx eocontext.EoContext) (IWebsocketContext, error)
type WebsocketFilter ¶ added in v0.8.0
type WebsocketFilter interface {
DoWebsocketFilter(ctx IWebsocketContext, next eocontext.IChain) error
}
Click to show internal directories.
Click to hide internal directories.