commit | c1e1988808464ec0c0a50d6724536d9ad5018ecf | [log] [tgz] |
---|---|---|
author | Xinyun Zhou <me@xyzhou.com> | Thu Jul 27 22:17:18 2017 +1000 |
committer | Xinyun Zhou <me@xyzhou.com> | Thu Jul 27 22:17:18 2017 +1000 |
tree | 9bd87d0a01c584a32a60846105bc093a5b5f27fa | |
parent | 858170f51996773038b54ad4b1cd71e6396d34a9 [diff] |
minor fixes to improve readability
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*