We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there an idiomatic way to add a header to any given request? It seems below doesn't quite work. No header is attached to the ouath call:
type CustomTransport struct { Base http.RoundTripper } func (t *CustomTransport) RoundTrip(req *http.Request) (*http.Response, error) { req.Header.Add("My-Header", "whatever") fmt.Println(req.Header) return t.Base.RoundTrip(req) } func Temp() error { credentials, err := google.CredentialsFromJSON(context.Background(), []byte("my-creds"), sheets.SpreadsheetsReadonlyScope) if err != nil { return err } client := &http.Client{ Transport: &CustomTransport{ Base: oauth2.NewClient(context.Background(), credentials.TokenSource).Transport, }, } sheetClient, err := sheets.NewService(context.Background(), option.WithHTTPClient(client)) if err != nil { return err } do, err := sheetClient.Spreadsheets.Get("ID").Do() if err != nil { return err } fmt.Println(do) return nil }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is there an idiomatic way to add a header to any given request? It seems below doesn't quite work.
No header is attached to the ouath call:
The text was updated successfully, but these errors were encountered: