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

# README

httpclient

http client

Install:

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

Usage

Making a simple GET request

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

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
No description provided by the author

# Interfaces

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

# Type aliases

OptionFunc is a function that configures a client.