Documentation ¶
Index ¶
- Constants
- func Download(url, filename string) error
- func Exists(url string) (bool, error)
- func GPTStream(url string, data []byte, cb func(b []byte)) error
- func Get(url string) ([]byte, error)
- 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) Download(url, filename string) (err error)
- func (r *Request) GPTStream(url string, data []byte, cb func(b []byte)) 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 = "goo-http-request" CONTENT_TYPE_XML = "application/xml" CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_FORM = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
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 ¶ added in v1.0.25
func (*Request) JsonContentType ¶
func (*Request) SetContentType ¶
Click to show internal directories.
Click to hide internal directories.