Documentation ¶
Index ¶
- Constants
- func Get(url string) ([]byte, error)
- func GetClientIp(r *http.Request) string
- func GetWithQuery(url string, data []byte) ([]byte, error)
- func Post(url string, data []byte) ([]byte, error)
- func PostJson(url string, data []byte) ([]byte, error)
- func Put(url string, data []byte) ([]byte, error)
- func Upload(url, fileField, fileName string, fh io.Reader, data map[string]string) (b []byte, err error)
- type Option
- type Request
- func (r *Request) Debug() *Request
- func (r *Request) Do(method, url string, reader io.Reader) (rst []byte, err error)
- func (r *Request) Get(url string) ([]byte, error)
- func (r *Request) GetWithQuery(url string, data []byte) ([]byte, error)
- func (r *Request) JsonContentType() *Request
- func (r *Request) Post(url string, data []byte) ([]byte, error)
- func (r *Request) PostJson(url string, data []byte) ([]byte, error)
- func (r *Request) Put(url string, data []byte) ([]byte, error)
- func (r *Request) SetContentType(contentType string) *Request
- func (r *Request) SetHeader(name, value string) *Request
- func (r *Request) SetTimeout(d time.Duration) *Request
- func (r *Request) Upload(url, fileField, fileName string, fh io.Reader, data map[string]string) ([]byte, error)
- type Tls
Constants ¶
View Source
const ( TAG = "gohttp" CONTENT_TYPE_XML = "application/xml" CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_FORM = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
func GetClientIp ¶
GetClientIp returns the client ip of this request without port. Note that this ip address might be modified by client header.
Types ¶
type Option ¶
type Option struct { Name string Value interface{} }
func ContentTypeFormOption ¶
func ContentTypeFormOption() Option
func ContentTypeJsonOption ¶
func ContentTypeJsonOption() Option
func ContentTypeXmlOption ¶
func ContentTypeXmlOption() Option
func DebugOption ¶
func DebugOption() Option
func HeaderOption ¶
type Request ¶
type Request struct { Headers map[string]string Tls *Tls // contains filtered or unexported fields }
func (*Request) GetWithQuery ¶
func (*Request) JsonContentType ¶
func (*Request) SetContentType ¶
Click to show internal directories.
Click to hide internal directories.