Skip to content

Commit b1f192b

Browse files
committed
Populate ETag on object get
1 parent 2d4be15 commit b1f192b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/fixtures/gcs-fixture/src/main/java/fixture/gcs/GoogleCloudStorageHttpHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ public void handle(final HttpExchange exchange) throws IOException {
150150
response = blob.contents().slice(Math.toIntExact(range.start()), Math.toIntExact(lastIndex - range.start() + 1));
151151
statusCode = RestStatus.PARTIAL_CONTENT.getStatus();
152152
}
153+
// I think it's enough to use the generation here, at least until
154+
// we implement "metageneration", at that point we must incorporate both
155+
// See: https://cloud.google.com/storage/docs/metadata#etags
156+
exchange.getResponseHeaders().add("ETag", String.valueOf(blob.generation()));
153157
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
154158
exchange.sendResponseHeaders(statusCode, response.length());
155159
response.writeTo(exchange.getResponseBody());

0 commit comments

Comments
 (0)