2019-05-31 01:52:10 +03:00
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2020-01-30 14:39:00 +03:00
|
|
|
"github.com/micro/go-micro/v2/client/selector"
|
|
|
|
"github.com/micro/go-micro/v2/registry"
|
2019-05-31 01:52:10 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func NewRoundTripper(opts ...Option) http.RoundTripper {
|
|
|
|
options := Options{
|
|
|
|
Registry: registry.DefaultRegistry,
|
|
|
|
}
|
|
|
|
for _, o := range opts {
|
|
|
|
o(&options)
|
|
|
|
}
|
|
|
|
|
|
|
|
return &roundTripper{
|
|
|
|
rt: http.DefaultTransport,
|
|
|
|
st: selector.Random,
|
|
|
|
opts: options,
|
|
|
|
}
|
|
|
|
}
|