Skip to content

AsGz/httpAuthClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

httpAuthClient

Add digest authenticates header for http request

reference resources:

example

go get github.com/AsGz/httpAuthClient

url := "https:xxxxxxxxx"
username := "yourname"
password := "pass"

params := "params"
req, err := http.NewRequest("POST", url, strings.NewReader(params))
req.Header.Set("Content-Type", "application/json")

err = httpAuthClient.ApplyHttpDigestAuth(username, password, url, req)
if err != nil {
	log.Fatal(err)
} else {
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	var b []byte
	b, err = ioutil.ReadAll(resp.Body)
	fmt.Println(resp.StatusCode, string(b), err)
}

About

golang http auth client; like HTTP Digest Auth etc.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages