Documentation ¶
Index ¶
- Constants
- func DrainBody(b io.ReadCloser) (r1 []byte, r2 io.ReadCloser, err error)
- func New(man interface{}, optionFns ...OptionFn)
- func NewE(man interface{}, optionFns ...OptionFn) error
- type DownloadFile
- type DumpRequestLogger
- type DumpResponseLogger
- type HTTPClient
- type Keepalive
- type Logger
- type LoggerNoop
- type Method
- type Option
- type OptionFn
- type StructField
- type StructValue
- type T
- type TLSConfDir
- type TLSConfFiles
- type Timeout
- type URL
- type UploadFile
Constants ¶
const (
// HeadJSON is the const content type of JSON.
HeadJSON = "application/json; charset=utf-8"
)
Variables ¶
This section is empty.
Functions ¶
func DrainBody ¶
func DrainBody(b io.ReadCloser) (r1 []byte, r2 io.ReadCloser, err error)
DrainBody reads all of b to memory and then returns two equivalent ReadClosers yielding the same bytes.
It returns an error if the initial slurp of all bytes fails. It does not attempt to make the returned ReadClosers have identical error-matching behavior.
Types ¶
type DownloadFile ¶
DownloadFile represents the downloaded file.
type DumpRequestLogger ¶
type DumpRequestLogger interface { // Dump logs the dmp Dump(dump []byte) }
DumpRequestLogger is the interface for http dump.
type DumpResponseLogger ¶
type DumpResponseLogger interface { // Dump logs the dmp Dump(dump []byte) }
DumpResponseLogger is the interface for http dump.
type HTTPClient ¶
HTTPClient defines the interface for HTTP client.
type Keepalive ¶
type Keepalive string
Keepalive is the keep-alive flag (true(on,yes,1) /false(no, off,0), default true.
func (Keepalive) IsKeepAlive ¶
IsKeepAlive tells the keepalive option is enabled or not.
type Logger ¶
type Logger interface { // LogError logs the error LogError(err error) }
Logger is the interface for http logging.
type LoggerNoop ¶
type LoggerNoop struct{}
LoggerNoop implements the interface for dao logging with NOOP.
type Option ¶
type Option struct { // URL ... URL string // Method ... Method string // Keepalive ... Keepalive string // Timeout ... Timeout string // TLSConfFiles like clientKeyFile,clientCertFile,serverRootCA(required=false) TLSConfFiles string TLSConfDir string ErrSetter func(err error) Logger Logger Client HTTPClient // contains filtered or unexported fields }
Option is the options for Man.
type OptionFn ¶
type OptionFn func(*Option)
OptionFn is the func prototype for Option.
func WithClient ¶
func WithClient(c HTTPClient) OptionFn
WithClient specifies the http client for the man.
type StructField ¶
type StructField struct { Parent *StructValue Field reflect.Value Index int StructField reflect.StructField Type reflect.Type Name string Tag reflect.StructTag Kind reflect.Kind PkgPath string }
StructField represents the information of a struct's field
type StructValue ¶
type StructValue struct { StructSelf reflect.Value NumField int FieldTypes []reflect.StructField }
StructValue represents the
func MakeStructValue ¶
func MakeStructValue(structSelf reflect.Value) *StructValue
MakeStructValue makes a StructValue by a struct's value.
func (*StructValue) FieldByIndex ¶
func (s *StructValue) FieldByIndex(index int) StructField
FieldByIndex return the StructField at index
type TLSConfDir ¶
type TLSConfDir string
TLSConfDir specifies the TLSFiles configuration files directly for the client. like client.key,client.pem,root.pem
type TLSConfFiles ¶
type TLSConfFiles string
TLSConfFiles specifies the TLS configuration files for the client. like client.key,client.pem,root.pem