diff --git a/hadoop-ozone/dist/src/main/smoketest/s3/objecthead.robot b/hadoop-ozone/dist/src/main/smoketest/s3/objecthead.robot index 66f3461b01dd..88bbb55a360e 100644 --- a/hadoop-ozone/dist/src/main/smoketest/s3/objecthead.robot +++ b/hadoop-ozone/dist/src/main/smoketest/s3/objecthead.robot @@ -34,6 +34,7 @@ Head existing object ${result} = Execute AWSS3APICli and checkrc put-object --bucket ${BUCKET} --key ${PREFIX}/headobject/key=value/f1 --body /tmp/testfile 0 ${result} = Execute AWSS3APICli and checkrc head-object --bucket ${BUCKET} --key ${PREFIX}/headobject/key=value/f1 0 + Should Contain ${result} "StorageClass": ${result} = Execute AWSS3APICli and checkrc delete-object --bucket ${BUCKET} --key ${PREFIX}/headobject/key=value/f1 0 Head object in non existing bucket diff --git a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java index 21718295b9c1..17a6f6c06639 100644 --- a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java +++ b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java @@ -644,9 +644,14 @@ public Response head( throw ex; } + S3StorageType s3StorageType = key.getReplicationConfig() == null ? + S3StorageType.STANDARD : + S3StorageType.fromReplicationConfig(key.getReplicationConfig()); + ResponseBuilder response = Response.ok().status(HttpStatus.SC_OK) .header("Content-Length", key.getDataSize()) - .header("Content-Type", "binary/octet-stream"); + .header("Content-Type", "binary/octet-stream") + .header(STORAGE_CLASS_HEADER, s3StorageType.toString()); String eTag = key.getMetadata().get(ETAG); if (eTag != null) {