commit | a10a9246923181c49ca8e12cfb9904589ba05fd8 | [log] [tgz] |
---|---|---|
author | Jacob Zhou <me@xyzhou.com> | Fri Apr 29 11:05:39 2022 +1000 |
committer | GitHub <noreply@github.com> | Fri Apr 29 11:05:39 2022 +1000 |
tree | 4b687a2a3b596b01e9d98c210bda5029373af9ef | |
parent | 24f8b6105be82c6e326ee0fde627b7ba86936a9f [diff] |
Update README.md
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)