Documentation
¶
Index ¶
Constants ¶
Variables ¶
View Source
var ( /* Http versions */ HttpVerUn = []byte{0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e} //unknown HttpVer10 = []byte{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30} // HTTP/1.0 HttpVer11 = []byte{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31} // HTTP/1.1 HttpVer20 = []byte{0x48, 0x54, 0x54, 0x50, 0x2f, 0x32, 0x2e, 0x30} // HTTP/2.0 /* http connection */ HttpClose = []byte{0x63, 0x6c, 0x6f, 0x73, 0x65} // close /* Http Status Code */ St200 = []byte(" 200 OK") St403 = []byte(" 403 Forbidden") St404 = []byte(" 404 Not Found") St405 = []byte(" 405 Method Not Allowed") )
Functions ¶
This section is empty.
Types ¶
type ChRequest ¶
type ChRequest struct { Method int Resource []byte Version []byte Args []byte ArgsMap map[string]string Header map[string][]byte Body []byte }
func (*ChRequest) GetHttpVersion ¶
GetHttpVersion get the client http request version
func (*ChRequest) GetQueryArgument ¶
GetQueryArgument get the client http request argument
type ChResponse ¶
func ChMethodNotAllowed ¶
func ChMethodNotAllowed() *ChResponse
ChMethodNotAllowed return 405 html content
func NewChResponse ¶
func NewChResponse() *ChResponse
func (*ChResponse) Jsonify ¶
func (cr *ChResponse) Jsonify(v map[string]interface{}) (ok bool)
func (*ChResponse) SetReturnJson ¶
func (cr *ChResponse) SetReturnJson()
type ChRouters ¶
type ChRouters struct { Routers map[string]struct { Method []int Handler func(req *ChRequest, res *ChResponse) *ChResponse } }
func (*ChRouters) Add ¶
func (cr *ChRouters) Add(router string, methods []int, handler func(req *ChRequest, res *ChResponse) *ChResponse)
Add add a router into chainx routers map
Click to show internal directories.
Click to hide internal directories.