AWSS3 headObject
returns Error Domain=com.amazonaws.AWSS3ErrorDomain Code=0
instead of AWSS3ErrorNoSuchKey
#5496
Labels
Describe the bug
When performing a
AWSS3.headObject
on a missing key, the SDK returns aError Domain=com.amazonaws.AWSS3ErrorDomain Code=0
instead of a AWSS3ErrorNoSuchKey code.To Reproduce
Steps to reproduce the behavior, make a
headObject
request on a missing key.Observed Behavior
No result is present as expected, but the error is
Error Domain=com.amazonaws.AWSS3ErrorDomain Code=0
.Expected Behavior
The error should be
AWSS3ErrorNoSuchKey
. This is what is documented:Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?
AWSS3
Environment(please complete the following information):
Additional context
I think the problem is that the HEAD request doesn't return a body, but the SDK parses errors from the body. In the case of an HEAD request, the NoSuchKey error should just be inferred from the HTTP 404 status as head object requests from S3 don't return a body.
The text was updated successfully, but these errors were encountered: