- When creating context, use
digestRequest.ContextWithClient()
forappengine.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))
}