http
v0.3.1
github.com/eqto/http
Documentation
pkg.go.dev ↗Constants
MethodPost (3 declarations)
const ( MethodPost = fasthttp.MethodPost MethodGet = fasthttp.MethodGet MethodPut = fasthttp.MethodPut )
Types
Cookie
type Cookie struct {
Value string
}
Header
type Header struct {
// contains filtered or unexported fields
}
Header.Cookie
func (h *Header) Cookie(key string) *Cookie
Header.Get
func (r *Header) Get(key string) string
Header.Set
func (r *Header) Set(key, value string)
Request
type Request struct {
// contains filtered or unexported fields
}
NewRequest
func NewRequest(method, url string, body io.Reader) *Request
Request.Do
func (r *Request) Do() (*Response, error)
Request.DoTimeout
func (r *Request) DoTimeout(timeout time.Duration) (*Response, error)
Request.Get
func (r *Request) Get(url string) (*Response, error)
Request.Post
func (r *Request) Post(url string, body io.Reader) (*Response, error)
Request.Put
func (r *Request) Put(url string, body io.Reader) (*Response, error)
Request.SetHeader
func (r *Request) SetHeader(key, val string)
Request.SetQuery
func (r *Request) SetQuery(key, val string)
Request.SetQueryInt
func (r *Request) SetQueryInt(key string, val int)
Response
type Response struct {
// contains filtered or unexported fields
}
Get
func Get(url string) (*Response, error)
Post
func Post(url, contentType string, body io.Reader) (*Response, error)
Put
func Put(url, contentType string, body io.Reader) (*Response, error)
Response.Body
func (r *Response) Body() io.ReadCloser
Response.Error
func (r *Response) Error() error
Response.Header
func (r *Response) Header() *Header
Response.IsError
func (r *Response) IsError() bool
Response.StatusCode
func (r *Response) StatusCode() int