Export Transport to allow default transport to be configurable.

This commit is contained in:
Burcu Dogan 2014-07-14 10:59:30 -07:00
parent 6b4f2ed2ce
commit 7935ece62b
1 changed files with 8 additions and 2 deletions

View File

@ -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,