http

package
v0.14.9-b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

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) Get added in v0.13.2

func (h GHttp) Get(serviceName string, path string, headers map[string]string, params map[string]any, result any) (*response.Response, error)

func (GHttp) GetUrl added in v0.13.2

func (h GHttp) GetUrl(url string, headers map[string]string, params map[string]any, result any) (*response.Response, error)

func (GHttp) GetUrlWithTimeout added in v0.13.2

func (h GHttp) GetUrlWithTimeout(url string, headers map[string]string, params map[string]any, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) GetWithTimeout added in v0.13.2

func (h GHttp) GetWithTimeout(serviceName string, path string, headers map[string]string, params map[string]any, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) Post added in v0.13.2

func (h GHttp) Post(serviceName string, path string, headers map[string]string, params map[string]any, result any) (*response.Response, error)

func (GHttp) PostFile added in v0.13.2

func (h GHttp) PostFile(url string, headers map[string]string, params map[string]any, files map[string]*request.File, result any) (*response.Response, error)

func (GHttp) PostFileWithTimeout added in v0.13.2

func (h GHttp) PostFileWithTimeout(url string, headers map[string]string, params map[string]any, files map[string]*request.File, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) PostFormData added in v0.13.2

func (h GHttp) PostFormData(serviceName string, path string, headers map[string]string, params url.Values, result any) (*response.Response, error)

func (GHttp) PostFormDataUrl added in v0.13.2

func (h GHttp) PostFormDataUrl(url string, headers map[string]string, params url.Values, result any) (*response.Response, error)

func (GHttp) PostFormDataUrlWithTimeout added in v0.13.2

func (h GHttp) PostFormDataUrlWithTimeout(url string, headers map[string]string, params url.Values, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) PostFormDataWithTimeout added in v0.13.2

func (h GHttp) PostFormDataWithTimeout(serviceName string, path string, headers map[string]string, params url.Values, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) PostJSON added in v0.13.2

func (h GHttp) PostJSON(serviceName string, path string, headers map[string]string, params any, result any) (*response.Response, error)

func (GHttp) PostJSONUrl added in v0.13.2

func (h GHttp) PostJSONUrl(url string, headers map[string]string, params any, result any) (*response.Response, error)

func (GHttp) PostJSONUrlWithTimeout added in v0.13.2

func (h GHttp) PostJSONUrlWithTimeout(url string, headers map[string]string, params any, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) PostJSONWithTimeout added in v0.13.2

func (h GHttp) PostJSONWithTimeout(serviceName string, path string, headers map[string]string, params any, result any, timeout time.Duration) (*response.Response, error)

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 (h GHttp) PostUrlWithTimeout(url string, headers map[string]string, params map[string]any, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) PostWithTimeout added in v0.13.2

func (h GHttp) PostWithTimeout(serviceName string, path string, headers map[string]string, params map[string]any, result any, timeout time.Duration) (*response.Response, error)

func (GHttp) WithTracerContext added in v0.13.2

func (h GHttp) WithTracerContext(ctx context.Context) GHttp

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL