Documentation ¶
Index ¶
- func HTTPResponse(req *restful.Request, rsp *restful.Response, code uint32)
- func ParseJsonBody(req *restful.Request, value interface{}) error
- func ParseQueryParams(req *restful.Request) map[string]string
- type Handler
- func (h *Handler) Parse(message proto.Message) (context.Context, error)
- func (h *Handler) ParseArray(createMessage func() proto.Message) (context.Context, error)
- func (h *Handler) ParseHeaderContext() context.Context
- func (h *Handler) WriteHeader(polarisCode uint32, httpStatus int)
- func (h *Handler) WriteHeaderAndProto(obj api.ResponseMessage)
- func (h *Handler) WriteHeaderAndProtoV2(obj apiv2.ResponseMessage)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPResponse ¶
func HTTPResponse(req *restful.Request, rsp *restful.Response, code uint32)
HTTPResponse http答复简单封装
func ParseJsonBody ¶
func ParseJsonBody(req *restful.Request, value interface{}) error
ParseJsonBody parse http body as json object
func ParseQueryParams ¶
ParseQueryParams 解析并获取HTTP的query params
Types ¶
type Handler ¶
type Handler struct { Request *restful.Request Response *restful.Response }
Handler HTTP请求/回复处理器
func (*Handler) ParseArray ¶
ParseArray 解析PB数组对象
func (*Handler) ParseHeaderContext ¶
ParseHeaderContext 将http请求header中携带的用户信息提取出来
func (*Handler) WriteHeader ¶
WriteHeader 仅返回Code
func (*Handler) WriteHeaderAndProto ¶
func (h *Handler) WriteHeaderAndProto(obj api.ResponseMessage)
WriteHeaderAndProto 返回Code和Proto
func (*Handler) WriteHeaderAndProtoV2 ¶
func (h *Handler) WriteHeaderAndProtoV2(obj apiv2.ResponseMessage)
WriteHeaderAndProtoV2 返回Code和Proto
Click to show internal directories.
Click to hide internal directories.