File tree 2 files changed +18
-6
lines changed
2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,11 @@ type ClientOptions struct {
74
74
Environment string
75
75
// Maximum number of breadcrumbs.
76
76
MaxBreadcrumbs int
77
+ // An optional pointer to `http.Client` that will be used with a default HTTPTransport.
78
+ // Using your own client will make HTTPTransport, HTTPProxy, HTTPSProxy and CaCerts options ignored.
79
+ HTTPClient * http.Client
77
80
// An optional pointer to `http.Transport` that will be used with a default HTTPTransport.
81
+ // Using your own transport will make HTTPProxy, HTTPSProxy and CaCerts options ignored.
78
82
HTTPTransport * http.Transport
79
83
// An optional HTTP proxy to use.
80
84
// This will default to the `http_proxy` environment variable.
Original file line number Diff line number Diff line change @@ -143,9 +143,13 @@ func (t *HTTPTransport) Configure(options ClientOptions) {
143
143
}
144
144
}
145
145
146
- t .client = & http.Client {
147
- Transport : t .transport ,
148
- Timeout : t .Timeout ,
146
+ if options .HTTPClient != nil {
147
+ t .client = options .HTTPClient
148
+ } else {
149
+ t .client = & http.Client {
150
+ Transport : t .transport ,
151
+ Timeout : t .Timeout ,
152
+ }
149
153
}
150
154
151
155
t .start .Do (func () {
@@ -276,9 +280,13 @@ func (t *HTTPSyncTransport) Configure(options ClientOptions) {
276
280
}
277
281
}
278
282
279
- t .client = & http.Client {
280
- Transport : t .transport ,
281
- Timeout : t .Timeout ,
283
+ if options .HTTPClient != nil {
284
+ t .client = options .HTTPClient
285
+ } else {
286
+ t .client = & http.Client {
287
+ Transport : t .transport ,
288
+ Timeout : t .Timeout ,
289
+ }
282
290
}
283
291
}
284
292
You can’t perform that action at this time.
0 commit comments