commit | 41469e92ebf64116206e2facdb024ea22fab5a3a | [log] [tgz] |
---|---|---|
author | Xinyun Zhou <me@xyzhou.com> | Wed May 15 14:41:13 2019 +1000 |
committer | GitHub <noreply@github.com> | Wed May 15 14:41:13 2019 +1000 |
tree | d1ba6c18f528c5addc22caec37d17de9ec1b7dce | |
parent | a94f932d0e642022c86eb575cc67738b17d524dc [diff] | |
parent | ea9536d69cccb121c16a7c68bf0f9f33c820ae1e [diff] |
Merge pull request #13 from nickysemenza/allow-setting-custom-http-client enable passing in a http client, for customizing TLS config and timeouts
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)