File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,9 +197,10 @@ func DefaultHTTPTransportSettings() HTTPTransportSettings {
197197// Unpack reads a config object into the settings.
198198func (settings * HTTPTransportSettings ) Unpack (cfg * config.C ) error {
199199 tmp := struct {
200- TLS * tlscommon.Config `config:"ssl"`
201- Timeout time.Duration `config:"timeout"`
202- IdleConnTimeout time.Duration `config:"idle_connection_timeout"`
200+ TLS * tlscommon.Config `config:"ssl"`
201+ Timeout time.Duration `config:"timeout"`
202+ IdleConnTimeout time.Duration `config:"idle_connection_timeout"`
203+ Auth * HTTPAuthorization `config:"auth"`
203204 }{
204205 Timeout : settings .Timeout ,
205206 IdleConnTimeout : settings .IdleConnTimeout ,
@@ -223,6 +224,7 @@ func (settings *HTTPTransportSettings) Unpack(cfg *config.C) error {
223224
224225 * settings = HTTPTransportSettings {
225226 TLS : tmp .TLS ,
227+ Auth : tmp .Auth ,
226228 Timeout : tmp .Timeout ,
227229 Proxy : proxy ,
228230 IdleConnTimeout : tmp .IdleConnTimeout ,
Original file line number Diff line number Diff line change 8383 Timeout : 5 * time .Second ,
8484 },
8585 },
86+ "includes auth" : {
87+ input : `
88+ auth:
89+ api_key: test-key
90+ timeout: 5s
91+ ` ,
92+ expected : HTTPTransportSettings {
93+ Auth : & HTTPAuthorization {
94+ APIKey : "test-key" ,
95+ },
96+ Timeout : 5 * time .Second ,
97+ },
98+ },
8699 }
87100 for name , tc := range tests {
88101 t .Run (name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments