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

Commit

Permalink
Merge pull request #19 from nitper/master
Browse files Browse the repository at this point in the history
custom HTTPClient for DigestTransport
  • Loading branch information
xinsnake committed Feb 9, 2020
2 parents 33b88a7 + a376213 commit 366d8cf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions digest_auth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type DigestRequest struct {
}

type DigestTransport struct {
Password string
Username string
Timeout time.Duration
Password string
Username string
HTTPClient *http.Client
}

// NewRequest creates a new DigestRequest object
Expand All @@ -40,7 +40,6 @@ func NewTransport(username, password string) DigestTransport {
dt := DigestTransport{}
dt.Password = password
dt.Username = username
dt.Timeout = 30 * time.Second
return dt
}

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

dr := NewRequest(username, password, method, uri, body)
if dt.HTTPClient != nil {
dr.HTTPClient = dt.HTTPClient
}

return dr.Execute()
}

Expand Down

0 comments on commit 366d8cf

Please sign in to comment.