Documentation ¶
Index ¶
- Constants
- Variables
- func FileWithContent(field, fileName string, content []byte) *file
- func FileWithPath(field string, path string) *file
- type Client
- func (s *Client) AddHook(h Hook)
- func (s *Client) Delete(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) Get(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) Head(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) Patch(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) Post(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) Put(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) ReqOptions(url string, opts ...ReqOption) (*Response, error)
- func (s *Client) Request(method, url string, opts ...ReqOption) (*Response, error)
- type ClientOption
- type Cookies
- type Ctx
- type Form
- type Gzip
- type Header
- type Hook
- type Json
- type Jsons
- type Params
- type ReqOption
- type Request
- type Response
- func Delete(url string, opts ...ReqOption) (*Response, error)
- func Get(url string, opts ...ReqOption) (*Response, error)
- func Head(url string, opts ...ReqOption) (*Response, error)
- func NewResponse(r *http.Response) (*Response, error)
- func Patch(url string, opts ...ReqOption) (*Response, error)
- func Post(url string, opts ...ReqOption) (*Response, error)
- func Put(url string, opts ...ReqOption) (*Response, error)
- func ReqOptions(url string, opts ...ReqOption) (*Response, error)
- type Timeout
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" OPTIONS = "OPTIONS" PATCH = "PATCH" HEAD = "HEAD" )
Variables ¶
View Source
var ( // ErrInvalidForm will be throw out when request form body data can not be Marshal ErrInvalidForm = errors.New("go-requests: Invalid Form value") // ErrInvalidJson will be throw out when request json body data can not be Marshal ErrInvalidJson = errors.New("go-requests: Invalid Json value") // ErrInvalidMethod will be throw out when method not in // [HEAD, GET, POST, DELETE, OPTIONS, PUT, PATCH, CONNECT, TRACE] ErrInvalidMethod = errors.New("go-requests: Method is invalid") //ErrInvalidFile will be throw out when get file content data ErrInvalidFile = errors.New("go-requests: Invalid file content") ErrInvalidBodyType = errors.New("go-requests: Invalid Body Type") ErrTimeout = errors.New("go-requests: timeout") )
View Source
var DefaultClient = &Client{Client: http.DefaultClient}
Functions ¶
func FileWithContent ¶ added in v0.1.3
func FileWithPath ¶ added in v0.1.3
Types ¶
type Client ¶ added in v0.1.3
func NewClient ¶ added in v0.1.3
func NewClient(opts ...ClientOption) *Client
func (*Client) ReqOptions ¶ added in v0.1.3
type ClientOption ¶ added in v0.1.3
type ClientOption func(client *Client)
func WithCheckRedirect ¶ added in v0.1.3
func WithJar ¶ added in v0.1.3
func WithJar(jar http.CookieJar) ClientOption
func WithTimeout ¶ added in v0.1.3
func WithTimeout(timeout time.Duration) ClientOption
func WithTransport ¶ added in v0.1.3
func WithTransport(transport http.RoundTripper) ClientOption
type Request ¶ added in v0.1.3
func NewRequest ¶ added in v0.1.3
NewRequest wraps NewRequestWithContext using the background context.
Click to show internal directories.
Click to hide internal directories.