commit | ddd37fe1722021e526546a269b5b5829a3d7b109 | [log] [tgz] |
---|---|---|
author | xinsnake <me@xyzhou.com> | Thu May 25 23:53:53 2017 +1000 |
committer | GitHub <noreply@github.com> | Thu May 25 23:53:53 2017 +1000 |
tree | 0f0db86271baeb784587300db4d7ada7c899d7d4 | |
parent | 76485d3c29f05a97bdc1d0d96d847d0a447fea76 [diff] | |
parent | 91831c53884680f19732198f60c37bc2e71a41bd [diff] |
Merge pull request #3 from xinsnake/roundtripper Implement http.RoundTripper
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)
}
fmt.Println(resp)
username*