这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jswoods
Copy link
Contributor

@jswoods jswoods commented Sep 23, 2021

Adds ability to pass in a transport when setting up the HTTP connection. Also adds a default HTTP timeout.

This allows clients using the API to reuse transports. This is intended as per https://pkg.go.dev/net/http#Transport:

By default, Transport caches connections for future re-use. This may leave many open connections when accessing many hosts. This behavior can be managed using Transport's CloseIdleConnections method and the MaxIdleConnsPerHost and DisableKeepAlives fields.

Transports should be reused instead of created as needed. Transports are safe for concurrent use by multiple goroutines.

@jswoods jswoods merged commit c2eface into master Sep 24, 2021
@jswoods jswoods deleted the jestin/add-client-with-transport-option branch September 24, 2021 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants