commit | 5419e7f9c96a08d2d57851b856842a26ab59183e | [log] [tgz] |
---|---|---|
author | Xinyun Zhou <me@xyzhou.com> | Mon Feb 10 02:53:11 2020 +1100 |
committer | GitHub <noreply@github.com> | Mon Feb 10 02:53:11 2020 +1100 |
tree | c77b5c05b95083e676f67ea248afb5737839e55f | |
parent | 366d8cf4538a318a96d8f0c5b5c4af396dd4b708 [diff] | |
parent | 9d6d3110b8a8d7450857bebd17b19410ce3ccfe6 [diff] |
Merge pull request #16 from reinventer/improvements Case insensitive algorithm name and small optimization
Golang Http Digest Authentication Client
This client implements RFC7616 HTTP Digest Access Authentication and by now the basic features should work.
// import import dac "github.com/xinsnake/go-http-digest-auth-client" // create a new digest authentication request dr := dac.NewRequest(username, password, method, uri, payload) response1, err := dr.Execute() // check error, get response // reuse the existing digest authentication request so no extra request is needed dr.UpdateRequest(username, password, method, uri, payload) response2, err := dr.Execute() // check error, get response
Or you can use it with http.Request
t := dac.NewTransport(username, password)
req, err := http.NewRequest(method, uri, payload)
if err != nil {
log.Fatalln(err)
}
resp, err := t.RoundTrip(req)
if err != nil {
log.Fatalln(err)
}
defer resp.Body.Close()
fmt.Println(resp)