Categorygithub.com/go-light/httpclient/v3
modulepackage
3.0.9
Repository: https://github.com/go-light/httpclient.git
Documentation: pkg.go.dev

# README

httpclient

http client

Install:

go get github.com/go-light/httpclient/v3

Usage

Making a simple GET request

// httpClient 
httpClient := NewClientV3(
		WithRetryCount(1),
		WithTimeout(Duration(2*time.Second)),
		WithMaxIdleConns(20000),
		WithMaxIdleConnsPerHost(100),
	)

headers := http.Header{}
headers.Set("Content-Type", "application/json")

type Data struct {
	Method string `json:"method"`
}

type Reply struct {
	ErrorCode int    `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
	Data      []Data `json:"data"`
}

reply := Reply{}
ret := NewClient("test.get",
	WithRetryCount(1),
	WithTimeout(2*time.Second),
	WithMaxIdleConns(20000),
	WithMaxIdleConnsPerHost(100),
).Get(context.Background(), url, headers, &reply)

fmt.Println(ret.LogEntry.Text())
fmt.Printf("%+v\n", reply)  

# Packages

No description provided by the author

# Functions

No description provided by the author
WithMaxIdleConns sets controls the maximum number of idle (keep-alive).
WithMaxIdleConnsPerHost sets controls the maximum idle.
WithRetryCount can be used to.
No description provided by the author

# Structs

No description provided by the author
ClientConfig is http client conf.
No description provided by the author

# Interfaces

No description provided by the author
Option represents the client options.

# Type aliases

Duration be used toml unmarshal string time, like 1s, 500ms.
OptionFunc is a function that configures a client.