Documentation ¶
Index ¶
- Constants
- func Map2XML(m map[string]string, rootName ...string) ([]byte, error)
- type DefaultLogger
- type JsonRpcReqDto
- type JsonRpcRespDto
- type MyXmldata
- type Options
- type RPCError
- type Request
- func (r *Request) Delete(uri string, opts ...Options) (*Response, error)
- func (r *Request) Get(uri string, opts ...Options) (*Response, error)
- func (r *Request) GetOptions() Options
- func (r *Request) Logf(format string, param ...interface{})
- func (r *Request) Options(uri string, opts ...Options) (*Response, error)
- func (r *Request) Patch(uri string, opts ...Options) (*Response, error)
- func (r *Request) Post(uri string, opts ...Options) (*Response, error)
- func (r *Request) Put(uri string, opts ...Options) (*Response, error)
- func (r *Request) Request(method, uri string, opts ...Options) (*Response, error)
- func (r *Request) SetOptions(o Options)
- type Response
- func (me *Response) GetBody() (ResponseBody, error)
- func (me *Response) GetHeader(name string) string
- func (me *Response) GetHeaderSlice(name string) []string
- func (me *Response) GetHeaders() map[string][]string
- func (me *Response) GetRequest() *http.Request
- func (me *Response) GetStatusCode() int
- func (me *Response) HasHeader(name string) bool
- func (me *Response) IsTimeout() bool
- type ResponseBody
- type Wg
- type WriterLogger
Constants ¶
View Source
const ( ContentTypeJson = "application/json" ContentTypeForm = "application/x-www-form-urlencoded" ContentTypeOctet = "application/octet-stream" ContentTypeMultipart = "multipart/form-data" ContentTypeXml = "application/xml" ContentTypeTexthtml = "text/html" ContentTypeTextxml = "text/xml" )
View Source
const ( // DefaultTimeout 默认超时值 DefaultTimeout = 15 * time.Second )
View Source
const (
TraceIdHeader = "X-Trace-Id"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DefaultLogger ¶
type DefaultLogger struct{}
func NewDefaultLogger ¶
func NewDefaultLogger() *DefaultLogger
func (DefaultLogger) Printf ¶
func (l DefaultLogger) Printf(format string, values ...interface{})
type JsonRpcReqDto ¶
type JsonRpcReqDto struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params interface{} `json:"params,omitempty"` Id interface{} `json:"id"` //字符串、int、unit、int8/16/32/64、uint8/16/32/64、null }
func NewJsonRpcReqDto ¶
func NewJsonRpcReqDto() JsonRpcReqDto
type JsonRpcRespDto ¶
type JsonRpcRespDto struct { Jsonrpc string `json:"jsonrpc"` Result *json.RawMessage `json:"result,omitempty"` Error *json.RawMessage `json:"error,omitempty"` Id interface{} `json:"id"` }
type MyXmldata ¶
func (MyXmldata) MarshalXML ¶
type Options ¶
type Options struct { Debug bool Log WriterLogger Timeout time.Duration Query interface{} Headers map[string]interface{} Cookies interface{} FormParams map[string]interface{} JSON interface{} XML interface{} Proxy string }
func NewOptions ¶
func NewOptions() Options
type RPCError ¶
type RPCError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
错误对象
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) GetOptions ¶
func (*Request) SetOptions ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) GetBody ¶
func (me *Response) GetBody() (ResponseBody, error)
func (*Response) GetHeaderSlice ¶
func (*Response) GetHeaders ¶
GetHeaders 获取所有请求头,也可通过 对象.GetRequest().Header获取原生http.Header类型
func (*Response) GetRequest ¶
func (*Response) GetStatusCode ¶
type ResponseBody ¶
type ResponseBody []byte
func (ResponseBody) GetContents ¶
func (me ResponseBody) GetContents() string
func (ResponseBody) String ¶
func (me ResponseBody) String() string
func (ResponseBody) ToByte ¶
func (me ResponseBody) ToByte() []byte
func (ResponseBody) ToString ¶
func (me ResponseBody) ToString() string
type WriterLogger ¶
type WriterLogger interface {
Printf(string, ...interface{})
}
WriterLogger 日志接口
Click to show internal directories.
Click to hide internal directories.