Documentation
¶
Index ¶
- Constants
- Variables
- func CloseAllTransports()
- func GetProxy(https bool) string
- func GetTransport(isHTTPS bool, proxy string) *http.Transport
- func SetFileRoot(root string) error
- type File
- type Request
- func (r *Request) AddFile(name, file string) *Request
- func (r *Request) AddFileBytes(name, pathname string, data []byte) *Request
- func (r *Request) AddHeader(name, value string) *Request
- func (r *Request) DelHeader(name string) *Request
- func (r *Request) Delete(data interface{}) *Response
- func (r *Request) Get() *Response
- func (r *Request) GetHeader(name string) string
- func (r *Request) HasHeader(name string) bool
- func (r *Request) Head(data interface{}) *Response
- func (r *Request) Patch(data interface{}) *Response
- func (r *Request) Post(data interface{}) *Response
- func (r *Request) Put(data interface{}) *Response
- func (r *Request) Send(method string, data interface{}) *Response
- func (r *Request) SetHeader(name string, value string) *Request
- func (r *Request) Stream(ctx context.Context, method string, data interface{}, ...) error
- func (r *Request) Upload(file string, chunksize int) *Response
- func (r *Request) WithContext(ctx context.Context) *Request
- func (r *Request) WithHeader(headers http.Header) *Request
- func (r *Request) WithQuery(values neturl.Values) *Request
- type Response
Constants ¶
View Source
const ( // HandlerReturnOk handler return ok HandlerReturnOk = 1 // HandlerReturnBreak handler return break HandlerReturnBreak = 0 // HandlerReturnError handler return error HandlerReturnError = -1 )
Variables ¶
View Source
var HTTPHandlers = map[string]process.Handler{
"get": processHTTPGet,
"post": processHTTPPost,
"put": processHTTPPut,
"patch": processHTTPPatch,
"delete": processHTTPDelete,
"head": processHTTPHead,
"send": processHTTPSend,
"stream": processHTTPStream,
}
HTTPHandlers the http handlers
Functions ¶
func CloseAllTransports ¶ added in v1.0.0
func CloseAllTransports()
CloseAllTransports closes all idle connections in the transport pool This is useful for testing and cleanup
func GetTransport ¶ added in v1.0.0
GetTransport returns a reusable HTTP transport for the given configuration
Types ¶
type File ¶ added in v1.0.0
type File struct {
Name string `json:"name"`
Path string `json:"path,omitempty"`
Data string `json:"data,omitempty"`
// contains filtered or unexported fields
}
File file
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request HTTP Request
func (*Request) AddFileBytes ¶ added in v1.0.0
AddFileBytes set the file
func (*Request) Stream ¶ added in v1.0.0
func (r *Request) Stream(ctx context.Context, method string, data interface{}, handler func(data []byte) int) error
Stream stream the request
func (*Request) WithContext ¶ added in v1.0.0
WithContext set the request context
func (*Request) WithHeader ¶
WithHeader set the request headers
Click to show internal directories.
Click to hide internal directories.