Use a ReadSeeker for upload content and rewind the offset on retries
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 7eedde2..62c006a 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -188,7 +188,7 @@
}
// Create is a function that creates a new object or replaces an existing object.
-func Create(c *gophercloud.ServiceClient, containerName, objectName string, content io.Reader, opts CreateOptsBuilder) CreateResult {
+func Create(c *gophercloud.ServiceClient, containerName, objectName string, content io.ReadSeeker, opts CreateOptsBuilder) CreateResult {
var res CreateResult
url := createURL(c, containerName, objectName)
diff --git a/openstack/objectstorage/v1/objects/requests_test.go b/openstack/objectstorage/v1/objects/requests_test.go
index 6be3534..941e59e 100644
--- a/openstack/objectstorage/v1/objects/requests_test.go
+++ b/openstack/objectstorage/v1/objects/requests_test.go
@@ -3,6 +3,7 @@
import (
"bytes"
"io"
+ "strings"
"testing"
"github.com/rackspace/gophercloud/pagination"
@@ -85,7 +86,7 @@
defer th.TeardownHTTP()
HandleCreateTextObjectSuccessfully(t)
- content := bytes.NewBufferString("Did gyre and gimble in the wabe")
+ content := strings.NewReader("Did gyre and gimble in the wabe")
options := &CreateOpts{ContentType: "text/plain"}
res := Create(fake.ServiceClient(), "testContainer", "testObject", content, options)
th.AssertNoErr(t, res.Err)
@@ -96,7 +97,7 @@
defer th.TeardownHTTP()
HandleCreateTypelessObjectSuccessfully(t)
- content := bytes.NewBufferString("The sky was the color of television, tuned to a dead channel.")
+ content := strings.NewReader("The sky was the color of television, tuned to a dead channel.")
res := Create(fake.ServiceClient(), "testContainer", "testObject", content, &CreateOpts{})
th.AssertNoErr(t, res.Err)
}