commit | 33b88a70a26f6551150536db03d2bec28a00891a | [log] [tgz] |
---|---|---|
author | Xinyun Zhou <me@xyzhou.com> | Wed May 15 14:43:00 2019 +1000 |
committer | Xinyun Zhou <me@xyzhou.com> | Wed May 15 14:43:00 2019 +1000 |
tree | c81cacb390bf5e145130fcd0cae4156c5b08c81d | |
parent | 41469e92ebf64116206e2facdb024ea22fab5a3a [diff] |
remove passed dr from previous PR
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)