From 7935ece62b5df7d253af014bd27b272c4ba62587 Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Mon, 14 Jul 2014 10:59:30 -0700 Subject: [PATCH] Export Transport to allow default transport to be configurable. --- google/appengine.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/google/appengine.go b/google/appengine.go index ebdde07..df4efd1 100644 --- a/google/appengine.go +++ b/google/appengine.go @@ -14,8 +14,11 @@ import ( // AppEngineConfig represents a configuration for an // App Engine application's Google service account. type AppEngineConfig struct { - context appengine.Context - scopes []string + // Default transport to be used while constructing + // oauth2.Transport instances from this configuration. + Transport *urlfetch.Transport + context appengine.Context + scopes []string } // NewAppEngineConfig creates a new AppEngineConfig for the @@ -27,6 +30,9 @@ func NewAppEngineConfig(context appengine.Context, scopes []string) *AppEngineCo // NewTransport returns a transport that authorizes // the requests with the application's service account. func (c *AppEngineConfig) NewTransport() oauth2.Transport { + if c.Transport != nil { + return oauth2.NewAuthorizedTransport(c.Transport, c, nil) + } transport := &urlfetch.Transport{ Context: c.context, Deadline: 0,