Documentation
¶
Index ¶
- Constants
- Variables
- func MultiPartBody(paramName, filename string, fileRef io.Reader, params map[string]string) (body io.ReadWriter, contentType string, err error)
- func Request(entity HttpRequestEntity, method string, body io.Reader) (response *http.Response, err error)
- type ConnAuth
- type DefaultHttpGateway
- type HttpGateway
- type HttpRequestEntity
- type MultiPartBodyFunc
- type MultiPartUploadFunc
- type RequestAdaptor
- type RequestFunc
Constants ¶
View Source
const NO_CONTENT_TYPE string = ""
Variables ¶
View Source
var MultiPartUpload = func(conn ConnAuth, paramName, filename string, fileRef io.Reader, params map[string]string) (res *http.Response, err error) { var contentType string var rbody io.Reader if rbody, contentType, err = MultiPartBody(paramName, filename, fileRef, params); err == nil { var req *http.Request if req, err = http.NewRequest("POST", conn.Url, rbody); err == nil { if conn.Username != "" && conn.Password != "" { req.SetBasicAuth(conn.Username, conn.Password) } req.Header.Set("Content-Type", contentType) client := NewTransportClient() res, err = client.Do(req) } } return }
View Source
var NewHttpGateway = func() HttpGateway { return &DefaultHttpGateway{} }
View Source
var NewRoundTripper = func() http.RoundTripper { return &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } }
Functions ¶
func MultiPartBody ¶
Types ¶
type DefaultHttpGateway ¶
type DefaultHttpGateway struct{}
func (*DefaultHttpGateway) Get ¶
func (gateway *DefaultHttpGateway) Get(entity HttpRequestEntity) RequestAdaptor
func (*DefaultHttpGateway) Post ¶
func (gateway *DefaultHttpGateway) Post(entity HttpRequestEntity, body io.Reader) RequestAdaptor
func (*DefaultHttpGateway) Put ¶
func (gateway *DefaultHttpGateway) Put(entity HttpRequestEntity, body io.Reader) RequestAdaptor
type HttpGateway ¶
type HttpGateway interface {
Get(HttpRequestEntity) RequestAdaptor
Post(HttpRequestEntity, io.Reader) RequestAdaptor
Put(HttpRequestEntity, io.Reader) RequestAdaptor
}
type HttpRequestEntity ¶
type MultiPartBodyFunc ¶
type MultiPartUploadFunc ¶
type RequestAdaptor ¶
type RequestFunc ¶
Click to show internal directories.
Click to hide internal directories.