Add util
This commit is contained in:
23
util/http/http.go
Normal file
23
util/http/http.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user