您需要像这样传递持续时间(否则它将默认为5秒超时):
tr := &urlfetch.Transport{Context: c, Deadline: time.Duration(30) * time.Second}2016年1月2日更新:
有了新的GAE
golang软件包(
google.golang.org/appengine/*),情况已经改变。
urlfetch不再在运输中收到最后期限持续时间。
现在,您应该通过新的上下文包设置超时。例如,这是您设置1分钟期限的方式:
func someFunc(ctx context.Context) { ctx_with_deadline, _ := context.WithTimeout(ctx, 1*time.Minute) client := &http.Client{ Transport: &oauth2.Transport{ base: &urlfetch.Transport{Context: ctx_with_deadline}, }, }


