This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
go-monero/pkg/http/client.go
Ciro S. Costa 98e24e202d pkg/http: document client constructor
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-06-12 11:59:07 -04:00

24 lines
416 B
Go

package http
import (
"net/http"
"time"
)
// NewHTTPClient instantiates a new `http.Client` with a few defaults.
//
// `verbose`: if set, adds a transport that dumps all requests and responses to
// stdout.
//
func NewHTTPClient(verbose bool) *http.Client {
client := &http.Client{
Timeout: 15 * time.Second,
}
if verbose {
client.Transport = NewDumpTransport(http.DefaultTransport)
}
return client
}