-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.
Description
I was looking at the underlying HTTP requests made by this program:
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.cloud.storage.BlobId;
import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.StorageOptions;
import java.util.logging.Level;
import java.util.logging.Logger;
class X {
private static final String BUCKET_NAME = "mybucket";
public static void main(String[] args) throws Exception {
Logger.getLogger("com.google.api.client.http").setLevel(Level.ALL);
Logger.getLogger("").getHandlers()[0].setLevel(Level.ALL);
try (var s = StorageOptions.getDefaultInstance().getService()) {
var b = BlobId.of(BUCKET_NAME, "blob");
s.create(
BlobInfo.newBuilder(b).setContentType("text/plain").build(),
"hello world".getBytes(UTF_8));
s.delete(b);
}
}
}The actual object insertion request comes out like this:
POST https://storage.googleapis.com/upload/storage/v1/b/mybucket/o?projection=full&uploadType=multipart
Accept-Encoding: gzip
Authorization: Bearer redacted
User-Agent: gcloud-java/2.61.0 Google-API-Java-Client/2.7.2 Google-HTTP-Java-Client/2.0.2 (gzip)
x-goog-user-project:
x-goog-api-client: gl-java/21.0.9 gdcl/2.7.2 linux/6.17.0 gccl-invocation-id/2596662c-8ab2-4ff3-8bae-d7859bee9f6c
x-goog-gcs-idempotency-token: 2596662c-8ab2-4ff3-8bae-d7859bee9f6c
Content-Type: multipart/related; boundary=__END_OF_PART__3a425b6d-f309-4ccf-99cd-3a84be601630__
Content-Encoding: gzip
boundary=__END_OF_PART__3a425b6d-f309-4ccf-99cd-3a84be601630__' -H 'Content-Encoding: gzip' -d '@-' -- 'https://storage.googleapis.com/upload/storage/v1/b/mybucket/o?projection=full&uploadType=multipart' << $$$
Jan 12, 2026 4:12:05 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 449 bytes
Jan 12, 2026 4:12:05 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: --__END_OF_PART__3a425b6d-f309-4ccf-99cd-3a84be601630__
Content-Length: 94
Content-Type: application/json; charset=UTF-8
content-transfer-encoding: binary
{"bucket":"mybucket","contentType":"text/plain","crc32c":"yZRlqg==","name":"blob"}
--__END_OF_PART__3a425b6d-f309-4ccf-99cd-3a84be601630__
Content-Type: text/plain
content-transfer-encoding: binary
hello world
--__END_OF_PART__3a425b6d-f309-4ccf-99cd-3a84be601630__--
I noticed that the object body part doesn't include a Content-Length header even though that is known to the storage SDK.
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.