Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit 366d8cf

Browse files
authored
Merge pull request #19 from nitper/master
custom HTTPClient for DigestTransport
2 parents 33b88a7 + a376213 commit 366d8cf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

digest_auth_client.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ type DigestRequest struct {
2222
}
2323

2424
type DigestTransport struct {
25-
Password string
26-
Username string
27-
Timeout time.Duration
25+
Password string
26+
Username string
27+
HTTPClient *http.Client
2828
}
2929

3030
// NewRequest creates a new DigestRequest object
@@ -40,7 +40,6 @@ func NewTransport(username, password string) DigestTransport {
4040
dt := DigestTransport{}
4141
dt.Password = password
4242
dt.Username = username
43-
dt.Timeout = 30 * time.Second
4443
return dt
4544
}
4645

@@ -88,6 +87,10 @@ func (dt *DigestTransport) RoundTrip(req *http.Request) (resp *http.Response, er
8887
}
8988

9089
dr := NewRequest(username, password, method, uri, body)
90+
if dt.HTTPClient != nil {
91+
dr.HTTPClient = dt.HTTPClient
92+
}
93+
9194
return dr.Execute()
9295
}
9396

0 commit comments

Comments
 (0)