chihsuan commented on code in PR #11031:
URL: https://github.com/apache/ozone/pull/11031#discussion_r3794223906


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/exception/TestOS3Exceptions.java:
##########
@@ -18,15 +18,30 @@
 package org.apache.hadoop.ozone.s3.exception;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.Mockito.when;
 
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.hadoop.ozone.s3.RequestIdentifier;
 import org.apache.hadoop.ozone.web.utils.OzoneUtils;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
 
 /**
  * This class tests OS3Exception class.

Review Comment:
   nit: This class now also tests `OS3ExceptionMapper`. Could we update the 
class Javadoc accordingly?



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/exception/OS3ExceptionMapper.java:
##########
@@ -45,6 +46,7 @@ public Response toResponse(OS3Exception exception) {
     }
     exception.setRequestId(requestIdentifier.getRequestId());
     return Response.status(exception.getHttpCode())
+        .type(MediaType.APPLICATION_XML_TYPE)

Review Comment:
   I think the change is correct, but I noticed that the exact reproduction of 
HDDS-16189 follows the authentication-error path, which bypasses 
`OS3ExceptionMapper`. Should we also set `MediaType.APPLICATION_XML_TYPE` in 
`S3Utils.wrapOS3Exception()` and add a test for that?
   
   
https://github.com/apache/ozone/blob/1a4486a271b0d292ad8868f9664f17d03d0972d1/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/util/S3Utils.java#L141-L146



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to