-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
When we create a service with endpoint (option#WithEndpoint) using host and path, ie:
https://myhost.com/connections/google/
service, err := drive.NewService(ctx, option.WithHTTPClient(client))
...
tokenSource := option.WithTokenSource(oauth2.StaticTokenSource(&oauth2.Token{AccessToken: *token}))
endpointOptions := option.WithEndpoint("https://myhost.com/connections/google/")
options := []option.ClientOption{
tokenSource,
endpointOptions,
}it works well for operations like folder creation, as the URL will replaced by:
https://myhost.com/connections/google/files
Replaced by:
google-api-go-client/drive/v3/drive-gen.go
Line 5520 in 0077748
| urls := googleapi.ResolveRelative(c.s.BasePath, "files") |
But for media upload operations, like file creation, it is removing our endpoint path here:
google-api-go-client/drive/v3/drive-gen.go
Line 5522 in 0077748
| urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/drive/v3/files") |
Instead of calling this:
https://myhost.com/connections/google/upload/drive/v3/files
it's calling:
https://myhost.com/upload/drive/v3/files
The reason is the slash / at the beggining of the relstr during the googleapi.ResolveRelative func call.
This is the only operation that starts with slash, all others (like files, comments, etc) are appended to our custom endpoint.
Is it an issue or intentional?