1 Star 0 Fork 0

liuxuezhan / go-plugins

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
request.go 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
liuxuezhan 提交于 2021-08-18 17:35 . 'new'
package http
import (
"gitee.com/liuxuezhan/go-micro-v1.18.0/client"
"gitee.com/liuxuezhan/go-micro-v1.18.0/codec"
)
type httpRequest struct {
service string
method string
contentType string
request interface{}
opts client.RequestOptions
}
func newHTTPRequest(service, method string, request interface{}, contentType string, reqOpts ...client.RequestOption) client.Request {
var opts client.RequestOptions
for _, o := range reqOpts {
o(&opts)
}
if len(opts.ContentType) > 0 {
contentType = opts.ContentType
}
return &httpRequest{
service: service,
method: method,
request: request,
contentType: contentType,
opts: opts,
}
}
func (h *httpRequest) ContentType() string {
return h.contentType
}
func (h *httpRequest) Service() string {
return h.service
}
func (h *httpRequest) Method() string {
return h.method
}
func (h *httpRequest) Endpoint() string {
return h.method
}
func (h *httpRequest) Codec() codec.Writer {
return nil
}
func (h *httpRequest) Body() interface{} {
return h.request
}
func (h *httpRequest) Stream() bool {
return h.opts.Stream
}
1
https://gitee.com/liuxuezhan/go-plugins.git
git@gitee.com:liuxuezhan/go-plugins.git
liuxuezhan
go-plugins
go-plugins
db1d4b8b101e

搜索帮助