2019-05-30 23:52:10 +01:00
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2019-06-21 15:13:54 +01:00
|
|
|
"github.com/micro/go-micro/client/selector"
|
2019-06-21 17:20:41 +01:00
|
|
|
"github.com/micro/go-micro/registry"
|
2019-05-30 23:52:10 +01: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,
|
|
|
|
}
|
|
|
|
}
|