commit | 5ccd624e57708a174ff2cfb89e99f1222bbece20 | [log] [tgz] |
---|---|---|
author | paul-hoehne <paul.hoehne@marklogic.com> | Tue Nov 28 09:08:25 2017 -0500 |
committer | paul-hoehne <paul.hoehne@marklogic.com> | Tue Nov 28 09:08:25 2017 -0500 |
tree | cc79288a66a7298fa298cd7efe4e12f14096cfd2 | |
parent | 366760120fe0342664d581b235be4eb08aca8834 [diff] |
Adding headers to request and fixing case on URI name
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)