Skip to content

delphinus/go-digest-request

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-digest-request - request with digest authentication in golang

CircleCI Coverage Status

Usage

  • When creating context, use digestRequest.ContextWithClient() for appengine.urlfetch in Google App Engine.
import (
  "fmt"
  "io/ioutil"
  "net/http"

  "github.com/delphinus/go-digest-request"
  "golang.org/x/net/context"
)

func main() {
  ctx := context.Background()
  r := digestRequest.New(ctx, "john", "hello") // username & password

  req, _ := http.NewRequest("GET", "http://example.com", nil)
  resp, _ := r.Do(req)
  defer resp.Body.Close()

  b, _ := ioutil.ReadAll(resp.Body)

  fmt.Println(string(b))
}