go - GOLANG HTTP Basic-Auth with Google App Engine URLFetch -


how can add authorization header urlfetch client go?

there similar question answered java , python, not go.

urlfetch.client(ctx) returns http client (http://godoc.org/google.golang.org/appengine/urlfetch#client)

the http.client has methods get, post, etc... has do can hand arbitrary request. create request using http.newrequest:

req, err := http.newrequest("get", "http://www.google.com", nil) 

then can add header this:

req.header.set("authorization", "whatever") 

and call do:

res, err := client.do(req) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -