{"modulePath":"github.com/DoNewsCode/core","version":"v0.12.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package clihttp\n\nPackage clihttp adds opentracing support to http client.\n\n## Functions\n\n```go\nfunc Providers(options ...ProvidersOptionFunc) di.Deps\n```\nProviders provides the http client as a dependency. Depends On:\n\n\topentracing.Tracer\n\nProvides:\n\n\t*clihttp.Client\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient is a http client that traces http requests.\n\n```go\nfunc NewClient(tracer opentracing.Tracer, options ...Option) *Client\n```\nNewClient creates a Client with tracing support.\n\n```go\nfunc (c *Client) Do(req *http.Request) (*http.Response, error)\n```\nDo sends the request.\n\n```go\ntype ClientArgs struct {\n\tPopulator contract.DIPopulator\n}\n```\nClientArgs is the constructor argument for WithClientConstructor. See WithClientConstructor for usage.\n\n```go\ntype HttpDoer interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n```\nHttpDoer modules a upstream http client.\n\n```go\ntype Option func(*Client)\n```\nOption changes the behavior of Client.\n\n```go\nfunc WithDoer(doer contract.HttpDoer) Option\n```\nWithDoer is an option that accepts a HttpDoer as the underlying client.\n\n```go\nfunc WithRequestLogThreshold(num int) Option\n```\nWithRequestLogThreshold is options that sets threshold of request logging in number of bytes. If the payload is larger than this threshold, the log will be omit.\n\n```go\nfunc WithResponseLogThreshold(num int) Option\n```\nWithResponseLogThreshold is options that sets threshold of response logging in number of bytes. If the response body is larger than this threshold, the log will be omit.\n\n```go\ntype ProvidersOptionFunc func(options *providersOption)\n```\nProvidersOptionFunc is the type of functional providersOption for Providers. Use this type to change how Providers work.\n\n```go\nfunc WithClientConstructor(f func(args ClientArgs) (contract.HttpDoer, error)) ProvidersOptionFunc\n```\nWithClientConstructor instructs the Providers to accept an alternative constructor for the contract.HttpDoer to be wrapped by clihttp.NewClient.\n\n```go\nfunc WithClientOption(options ...Option) ProvidersOptionFunc\n```\nWithClientOption instructs the Providers to accept additional options for the NewClient call, such as WithRequestLogThreshold.\n\n","path":"github.com/DoNewsCode/core/clihttp","name":"clihttp","synopsis":"Package clihttp adds opentracing support to http client.","isRedistributable":true}
