Documentation ¶
Index ¶
- Constants
- func NewHttpClient(config *Config) *http.Client
- type Config
- type HttpRequest
- func (request *HttpRequest) Client() *http.Client
- func (request *HttpRequest) Delete(url string) *HttpRequest
- func (request *HttpRequest) Execute() (*HttpResponse, error)
- func (request *HttpRequest) Get(url string) *HttpRequest
- func (request *HttpRequest) Head(url string) *HttpRequest
- func (request *HttpRequest) Options(url string) *HttpRequest
- func (request *HttpRequest) Patch(url string) *HttpRequest
- func (request *HttpRequest) Post(url string) *HttpRequest
- func (request *HttpRequest) Put(url string) *HttpRequest
- func (request *HttpRequest) SetBody(body io.Reader) *HttpRequest
- func (request *HttpRequest) SetClient(config *Config) *HttpRequest
- func (request *HttpRequest) SetContext(context context.Context) *HttpRequest
- func (request *HttpRequest) SetHeader(header, value string) *HttpRequest
- func (request *HttpRequest) SetHeaders(headers map[string]string) *HttpRequest
- func (request *HttpRequest) SetQueryParam(param, value string) *HttpRequest
- func (request *HttpRequest) SetQueryParams(params map[string]string) *HttpRequest
- type HttpResponse
- func (response *HttpResponse) Bind(s interface{}) error
- func (response *HttpResponse) Body() io.ReadCloser
- func (response *HttpResponse) Cookies() []*http.Cookie
- func (response *HttpResponse) Header() http.Header
- func (response *HttpResponse) IsError() bool
- func (response *HttpResponse) IsSuccess() bool
- func (response *HttpResponse) Status() string
- func (response *HttpResponse) StatusCode() int
Constants ¶
View Source
const ( GetMethod = "GET" PostMethod = "POST" PutMethod = "PUT" DeleteMethod = "DELETE" PatchMethod = "PATCH" HeadMethod = "HEAD" OptionsMethod = "OPTIONS" )
Variables ¶
This section is empty.
Functions ¶
func NewHttpClient ¶
Types ¶
type HttpRequest ¶
type HttpRequest struct { URL string Method string Query url.Values Header http.Header Body io.Reader // contains filtered or unexported fields }
func BuildReq ¶
func BuildReq() *HttpRequest
func (*HttpRequest) Client ¶
func (request *HttpRequest) Client() *http.Client
func (*HttpRequest) Delete ¶
func (request *HttpRequest) Delete(url string) *HttpRequest
func (*HttpRequest) Execute ¶
func (request *HttpRequest) Execute() (*HttpResponse, error)
func (*HttpRequest) Get ¶
func (request *HttpRequest) Get(url string) *HttpRequest
func (*HttpRequest) Head ¶
func (request *HttpRequest) Head(url string) *HttpRequest
func (*HttpRequest) Options ¶
func (request *HttpRequest) Options(url string) *HttpRequest
func (*HttpRequest) Patch ¶
func (request *HttpRequest) Patch(url string) *HttpRequest
func (*HttpRequest) Post ¶
func (request *HttpRequest) Post(url string) *HttpRequest
func (*HttpRequest) Put ¶
func (request *HttpRequest) Put(url string) *HttpRequest
func (*HttpRequest) SetBody ¶
func (request *HttpRequest) SetBody(body io.Reader) *HttpRequest
func (*HttpRequest) SetClient ¶
func (request *HttpRequest) SetClient(config *Config) *HttpRequest
func (*HttpRequest) SetContext ¶
func (request *HttpRequest) SetContext(context context.Context) *HttpRequest
func (*HttpRequest) SetHeader ¶
func (request *HttpRequest) SetHeader(header, value string) *HttpRequest
func (*HttpRequest) SetHeaders ¶
func (request *HttpRequest) SetHeaders(headers map[string]string) *HttpRequest
func (*HttpRequest) SetQueryParam ¶
func (request *HttpRequest) SetQueryParam(param, value string) *HttpRequest
func (*HttpRequest) SetQueryParams ¶
func (request *HttpRequest) SetQueryParams(params map[string]string) *HttpRequest
type HttpResponse ¶
func NewHttpResponse ¶
func NewHttpResponse(res *http.Response) *HttpResponse
func (*HttpResponse) Bind ¶
func (response *HttpResponse) Bind(s interface{}) error
func (*HttpResponse) Body ¶
func (response *HttpResponse) Body() io.ReadCloser
func (*HttpResponse) Cookies ¶
func (response *HttpResponse) Cookies() []*http.Cookie
func (*HttpResponse) Header ¶
func (response *HttpResponse) Header() http.Header
func (*HttpResponse) IsError ¶
func (response *HttpResponse) IsError() bool
func (*HttpResponse) IsSuccess ¶
func (response *HttpResponse) IsSuccess() bool
func (*HttpResponse) Status ¶
func (response *HttpResponse) Status() string
func (*HttpResponse) StatusCode ¶
func (response *HttpResponse) StatusCode() int
Click to show internal directories.
Click to hide internal directories.