WithTransport sets the preferred transport for the HTTP client.
(addr string)
| 44 | |
| 45 | // WithTransport sets the preferred transport for the HTTP client. |
| 46 | func WithTransport(addr string) Option { |
| 47 | return func(o *opts) { |
| 48 | o.addr = addr |
| 49 | if strings.HasPrefix(addr, `npipe:///`) { |
| 50 | transport = &http.Transport{ |
| 51 | DialContext: api.DialPipe(addr), |
| 52 | } |
| 53 | } else { |
| 54 | transport = &http.Transport{ |
| 55 | DialContext: (&net.Dialer{}).DialContext, |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | // WithURI initializes the URI where the request is sent. |
| 62 | func WithURI(uri string) Option { |