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

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -