Thanks to visit codestin.com
Credit goes to github.com

Skip to content

theatrus/mediate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mediate

GoDoc Build Status

HTTP client transport for real-world and failure-tolerant communication in Go.

The following Golang adapters are designed to mix-in to the chain of http.RoundTrippers to add functionality such as:

  • FixedRetries: on recoverable errors, clone the request and attempt to re-issue it again a fixed number of times.
  • ReliableBody: consume the entire http.Response.Body into memory. If reading the body fails, the entire http.RoundTripper fails.
  • RateLimit: allow only N requests per given interval T through, blocking others.

Example

httpClient := &http.Client{}
httpClient.Transport = mediate.FixedRetries(3,
	mediate.ReliableBody(http.DefaultTransport),
)

About

Retryable, failure tolerant, and adaptive Golang HTTP client transports

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages