Created
October 3, 2012 04:22
-
-
Save jmhodges/3824984 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package comeatme | |
import ( | |
"code.google.com/p/google-api-go-client/plus/v1" | |
"net/http" | |
) | |
type SimpleKeyTransport struct { | |
Key string | |
Transport http.RoundTripper | |
} | |
func (t *SimpleKeyTransport) RoundTrip(r *http.Request) (*http.Response, error) { | |
q := r.URL.Query() | |
q.Set("key", t.Key) | |
r.URL.RawQuery = q.Encode() | |
return t.Transport.RoundTrip(r) | |
} | |
func main() { | |
// ... | |
t := &SimpleKeyTransport{Key: key, Transport: http.DefaultTransport} | |
client, err := plus.New(&http.Client{Transport: t}) | |
if err != nil { | |
return nil, err | |
} | |
p, err := client.People.Get("116810148281701144465").Do() | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment