Documentation
¶
Index ¶
- Constants
- Variables
- type GHttp
- func (h GHttp) DoUrl(urlStr, method, contentType string, headers map[string]string, ...) (*response.Response, error)
- func (h GHttp) Get(serviceName string, path string, headers map[string]string, ...) (*response.Response, error)
- func (h GHttp) GetUrl(url string, headers map[string]string, params map[string]any, result any) (*response.Response, error)
- func (h GHttp) GetUrlWithTimeout(url string, headers map[string]string, params map[string]any, result any, ...) (*response.Response, error)
- func (h GHttp) GetWithTimeout(serviceName string, path string, headers map[string]string, ...) (*response.Response, error)
- func (h GHttp) Post(serviceName string, path string, headers map[string]string, ...) (*response.Response, error)
- func (h GHttp) PostFile(url string, headers map[string]string, params map[string]any, ...) (*response.Response, error)
- func (h GHttp) PostFileWithTimeout(url string, headers map[string]string, params map[string]any, ...) (*response.Response, error)
- func (h GHttp) PostFormData(serviceName string, path string, headers map[string]string, params url.Values, ...) (*response.Response, error)
- func (h GHttp) PostFormDataUrl(url string, headers map[string]string, params url.Values, result any) (*response.Response, error)
- func (h GHttp) PostFormDataUrlWithTimeout(url string, headers map[string]string, params url.Values, result any, ...) (*response.Response, error)
- func (h GHttp) PostFormDataWithTimeout(serviceName string, path string, headers map[string]string, params url.Values, ...) (*response.Response, error)
- func (h GHttp) PostJSON(serviceName string, path string, headers map[string]string, params any, ...) (*response.Response, error)
- func (h GHttp) PostJSONUrl(url string, headers map[string]string, params any, result any) (*response.Response, error)
- func (h GHttp) PostJSONUrlWithTimeout(url string, headers map[string]string, params any, result any, ...) (*response.Response, error)
- func (h GHttp) PostJSONWithTimeout(serviceName string, path string, headers map[string]string, params any, ...) (*response.Response, error)
- func (h GHttp) PostUrl(url string, headers map[string]string, params map[string]any, result any) (*response.Response, error)
- func (h GHttp) PostUrlWithTimeout(url string, headers map[string]string, params map[string]any, result any, ...) (*response.Response, error)
- func (h GHttp) PostWithTimeout(serviceName string, path string, headers map[string]string, ...) (*response.Response, error)
- func (h GHttp) WithTracerContext(ctx context.Context) GHttp
Constants ¶
View Source
const ( HTTP_LOG_ENABLE_KEY = "server.http.log.params" // WRITE_TIMEOUT_PROPERTIES = "server.http.writeTimeout" // READ_TIMEOUT_PROPERTIES = "server.http.readTimeout" // RetryOnConnectionFailure = "server.http.retry.onConnectionFailure" // RetryEnabled = "server.http.retry.enabled" // RetryOnAllOperations = "server.http.retry.allOperations" // maxRetriesOnNextServiceInstance = "server.http.retry.maxRetriesOnNextServiceInstance" // RetryableStatusCodes = "server.http.retry.retryableStatusCodes" // RetryTimes = "server.http.retry.times" ContentTypeJson = "application/json;charset=utf-8" ContentTypeXWWWFormUrlencoded = "application/x-www-form-urlencoded;charset=utf-8" ContentTypeText = "text/plain;charset=utf-8" ContentTypehtml = "text/html;charset=utf-8" )
Variables ¶
View Source
var DefaultH2CClient = GHttp{H2C: true}
Functions ¶
This section is empty.
Types ¶
type GHttp ¶ added in v0.13.2
type GHttp struct {
H2C bool
// contains filtered or unexported fields
}
var DefaultClient GHttp
func (GHttp) DoUrl ¶ added in v0.13.2
func (h GHttp) DoUrl(urlStr, method, contentType string, headers map[string]string, queryParams url.Values, body []byte, result any, timeout time.Duration) (*response.Response, error)
通用请求方法
func (GHttp) GetUrlWithTimeout ¶ added in v0.13.2
func (GHttp) GetWithTimeout ¶ added in v0.13.2
func (GHttp) PostFileWithTimeout ¶ added in v0.13.2
func (GHttp) PostFormData ¶ added in v0.13.2
func (GHttp) PostFormDataUrl ¶ added in v0.13.2
func (GHttp) PostFormDataUrlWithTimeout ¶ added in v0.13.2
func (GHttp) PostFormDataWithTimeout ¶ added in v0.13.2
func (GHttp) PostJSONUrl ¶ added in v0.13.2
func (GHttp) PostJSONUrlWithTimeout ¶ added in v0.13.2
func (GHttp) PostJSONWithTimeout ¶ added in v0.13.2
func (GHttp) PostUrl ¶ added in v0.13.2
func (h GHttp) PostUrl(url string, headers map[string]string, params map[string]any, result any) (*response.Response, error)
同PostUrlWithTimeout
func (GHttp) PostUrlWithTimeout ¶ added in v0.13.2
func (GHttp) PostWithTimeout ¶ added in v0.13.2
Click to show internal directories.
Click to hide internal directories.