swift: explicitly set Expect header on methods that need it

This commit is contained in:
adriancole 2013-03-03 17:23:49 -08:00
parent b186220ff7
commit 2c3c3fad52
5 changed files with 13 additions and 1 deletions

View File

@ -80,12 +80,14 @@ public class CloudFilesBlobSignerExpectTest extends BaseBlobSignerExpectTest {
protected HttpRequest putBlob() { protected HttpRequest putBlob() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/name") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/name")
.addHeader("Expect", "100-continue")
.addHeader("X-Auth-Token", authToken).build(); .addHeader("X-Auth-Token", authToken).build();
} }
@Override @Override
protected HttpRequest putBlobWithTime() { protected HttpRequest putBlobWithTime() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.addHeader("Expect", "100-continue")
.endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/name?temp_url_sig=f83fa711f353f6f0bab3a66c56e35a972b9b3922&temp_url_expires=123456792").build(); .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/name?temp_url_sig=f83fa711f353f6f0bab3a66c56e35a972b9b3922&temp_url_expires=123456792").build();
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.openstack.swift; package org.jclouds.openstack.swift;
import static com.google.common.net.HttpHeaders.EXPECT;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -196,6 +198,7 @@ public interface CommonSwiftAsyncClient {
@Named("PutObject") @Named("PutObject")
@PUT @PUT
@Path("/{container}/{name}") @Path("/{container}/{name}")
@Headers(keys = EXPECT, values = "100-continue")
@ResponseParser(ParseETagHeader.class) @ResponseParser(ParseETagHeader.class)
ListenableFuture<String> putObject(@PathParam("container") String container, ListenableFuture<String> putObject(@PathParam("container") String container,
@PathParam("name") @ParamParser(ObjectName.class) @BinderParam(BindSwiftObjectMetadataToRequest.class) SwiftObject object); @PathParam("name") @ParamParser(ObjectName.class) @BinderParam(BindSwiftObjectMetadataToRequest.class) SwiftObject object);

View File

@ -78,6 +78,7 @@ public class SwiftBlobSignerExpectTest extends BaseBlobSignerExpectTest {
protected HttpRequest putBlob() { protected HttpRequest putBlob() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("http://storage/container/name") .endpoint("http://storage/container/name")
.addHeader("Expect", "100-continue")
.addHeader("X-Auth-Token", "testtoken").build(); .addHeader("X-Auth-Token", "testtoken").build();
} }
@ -85,6 +86,7 @@ public class SwiftBlobSignerExpectTest extends BaseBlobSignerExpectTest {
protected HttpRequest putBlobWithTime() { protected HttpRequest putBlobWithTime() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("http://storage/container/name?temp_url_sig=e894c60fa1284cc575cf22d7786bab07b8c33610&temp_url_expires=123456792") .endpoint("http://storage/container/name?temp_url_sig=e894c60fa1284cc575cf22d7786bab07b8c33610&temp_url_expires=123456792")
.addHeader("Expect", "100-continue")
.build(); .build();
} }

View File

@ -72,13 +72,16 @@ public class SwiftKeystoneBlobSignerExpectTest extends BaseBlobSignerExpectTest
protected HttpRequest putBlob() { protected HttpRequest putBlob() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name")
.addHeader("Expect", "100-continue")
.addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build();
} }
@Override @Override
protected HttpRequest putBlobWithTime() { protected HttpRequest putBlobWithTime() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=72e5f6ebafab2b3da0586198797e58fb7478211e&temp_url_expires=123456792").build(); .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=72e5f6ebafab2b3da0586198797e58fb7478211e&temp_url_expires=123456792")
.addHeader("Expect", "100-continue")
.build();
} }
@Override @Override

View File

@ -75,6 +75,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe
protected HttpRequest putBlob() { protected HttpRequest putBlob() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name")
.addHeader("Expect", "100-continue")
.addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build();
} }
@ -82,6 +83,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe
protected HttpRequest putBlobWithTime() { protected HttpRequest putBlobWithTime() {
return HttpRequest.builder().method("PUT") return HttpRequest.builder().method("PUT")
.endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=40806637803162%3Aidentity%3Ac90269245ab0a316d5ea5e654d4c2a975fb4bf77&temp_url_expires=123456792") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=40806637803162%3Aidentity%3Ac90269245ab0a316d5ea5e654d4c2a975fb4bf77&temp_url_expires=123456792")
.addHeader("Expect", "100-continue")
.build(); .build();
} }