Open GoogleCodeExporter opened 9 years ago
Hi kelleg...@gmail.com!
We have had similar problems and in talking to enterprise support we got the
following suggestion. Haven't quite had time to try it yet but hopefully it
will work:
Having Go library accept media content type will require few changes and a new
release, which might not suit your transition timelines. MediaType in Object
struct is not writable so we will need to introduce a new field to inject this
value to the Http request.
Here is a workaround that we think should work in the meantime. Please keep a
check on library upgrades to make sure this doesn't break in future.
a.) Create a wrapper over io.Reader object:
type StorageMedia struct {
io.Reader
Ctype string
}
And define a method.
// Returns Media Type.
func (sm StorageMedia) ContentType() string {
return sm.Ctype
}
b.) Now to upload an object, create a reader of type StorageMedia:
reader := StorageMedia{content, "text/css"}
And pass it to call upload service:
storage.NewObjectsService(service).Insert(bucket, &storage.Object{Name:
object}).Media(reader).Do()
Original comment by ianros...@gmail.com
on 26 Aug 2014 at 3:51
Original issue reported on code.google.com by
kelleg...@gmail.com
on 24 Mar 2014 at 12:30Attachments: