Documentation ¶
Index ¶
- Constants
- type ContentType
- type RestyClient
- func (c *RestyClient) R() *RestyRequest
- func (c *RestyClient) SetBaseUrl(baseUrl string) *RestyClient
- func (c *RestyClient) SetHeader(key, value string) *RestyClient
- func (c *RestyClient) SetHeaders(headers map[string]string) *RestyClient
- func (c *RestyClient) SetTimeout(timeout time.Duration) *RestyClient
- type RestyMethod
- type RestyRequest
- func (r *RestyRequest) Get(url string) (*resty.Response, error)
- func (r *RestyRequest) M(httpMethod string, url string) *RestyMethod
- func (r *RestyRequest) PostForm(url string, formEncode map[string]string) (*resty.Response, error)
- func (r *RestyRequest) PostJson(url string, jsonString string) (*resty.Response, error)
- func (r *RestyRequest) SetHeader(key, value string) *RestyRequest
- func (r *RestyRequest) SetHeaders(headers map[string]string) *RestyRequest
- func (r *RestyRequest) SetPathValues(pathParams map[string]string) *RestyRequest
- func (r *RestyRequest) SetQueryValues(any interface{}) *RestyRequest
- func (r *RestyRequest) SetReturnStruct(any interface{}) *RestyRequest
- func (r *RestyRequest) WithContext(ctx context.Context) *RestyRequest
Constants ¶
View Source
const (
HeadContentType = "content-type"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentType ¶
type ContentType string
const (
ContentTypeJson ContentType = "application/json"
)
type RestyClient ¶
type RestyClient struct {
// contains filtered or unexported fields
}
func NewRestyClient ¶
func NewRestyClient(proxyHttpHost ...string) *RestyClient
NewRestyClient 创建一个httpClient对象 proxyHttpHost 可以指定代理 localhost:7890
func (*RestyClient) SetBaseUrl ¶
func (c *RestyClient) SetBaseUrl(baseUrl string) *RestyClient
func (*RestyClient) SetHeader ¶
func (c *RestyClient) SetHeader(key, value string) *RestyClient
func (*RestyClient) SetHeaders ¶
func (c *RestyClient) SetHeaders(headers map[string]string) *RestyClient
func (*RestyClient) SetTimeout ¶
func (c *RestyClient) SetTimeout(timeout time.Duration) *RestyClient
type RestyMethod ¶ added in v0.0.5
type RestyMethod struct {
// contains filtered or unexported fields
}
func (*RestyMethod) E ¶ added in v0.0.5
func (m *RestyMethod) E() (*resty.Response, error)
E Execution
func (*RestyMethod) SetBodyForm ¶ added in v0.0.5
func (m *RestyMethod) SetBodyForm(formEncode map[string]string) *RestyMethod
func (*RestyMethod) SetBodyJson ¶ added in v0.0.5
func (m *RestyMethod) SetBodyJson(bodyJson *string) *RestyMethod
func (*RestyMethod) SetRequestBody ¶ added in v0.0.5
func (m *RestyMethod) SetRequestBody(bodyString *string, contentType ContentType) *RestyMethod
type RestyRequest ¶ added in v0.0.5
type RestyRequest struct {
// contains filtered or unexported fields
}
func (*RestyRequest) Get ¶ added in v0.0.5
func (r *RestyRequest) Get(url string) (*resty.Response, error)
func (*RestyRequest) M ¶ added in v0.0.5
func (r *RestyRequest) M(httpMethod string, url string) *RestyMethod
M set Method
func (*RestyRequest) PostForm ¶ added in v0.0.5
func (r *RestyRequest) PostForm(url string, formEncode map[string]string) (*resty.Response, error)
func (*RestyRequest) PostJson ¶ added in v0.0.5
func (r *RestyRequest) PostJson(url string, jsonString string) (*resty.Response, error)
func (*RestyRequest) SetHeader ¶ added in v0.0.5
func (r *RestyRequest) SetHeader(key, value string) *RestyRequest
func (*RestyRequest) SetHeaders ¶ added in v0.0.5
func (r *RestyRequest) SetHeaders(headers map[string]string) *RestyRequest
func (*RestyRequest) SetPathValues ¶ added in v0.0.5
func (r *RestyRequest) SetPathValues(pathParams map[string]string) *RestyRequest
func (*RestyRequest) SetQueryValues ¶ added in v0.0.5
func (r *RestyRequest) SetQueryValues(any interface{}) *RestyRequest
func (*RestyRequest) SetReturnStruct ¶ added in v0.0.5
func (r *RestyRequest) SetReturnStruct(any interface{}) *RestyRequest
func (*RestyRequest) WithContext ¶ added in v0.0.5
func (r *RestyRequest) WithContext(ctx context.Context) *RestyRequest
Click to show internal directories.
Click to hide internal directories.