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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -