blob: 42e0286cb6ce3d1426fd8d325486866ba91bcd60 [file] [log] [blame]
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
dac "github.com/xinsnake/go-http-digest-auth-client"
)
const (
username = "test"
password = "test123"
method = "GET"
uri = "http://172.16.1.5"
)
func main() {
var resp *http.Response
var body []byte
var err error
dr := dac.NewRequest(username, password, method, uri, "")
if resp, err = dr.Execute(); err != nil {
log.Fatalln(err)
}
defer resp.Body.Close()
if body, err = ioutil.ReadAll(resp.Body); err != nil {
log.Fatalln(err)
}
fmt.Printf(string(body))
}