-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 Client send
Throws/Rejects on 304
#2635
Comments
@AllanZhengYP made #1591 throw 3xx response as exceptions here. I understand why other 3xx redirections are thrown as exceptions, but should 304 be thrown as an exception? |
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Describe the bug
S3 JS client throws when IfNoneMatch causes a 304 response.
Your environment
SDK version number
@aws-sdk/[email protected]
Is the issue in the browser/Node.js/ReactNative?
Node.js
Details of the browser/Node.js/ReactNative version
Paste output of
npx envinfo --browsers
ornode -v
orreact-native -v
v14.17.3
Steps to reproduce
Pared down to the essentials. (Will not run as-is, but you can supply the vars, of course.)
Observed behavior
That last line throws:
Expected behavior
I do not consider 304 to be an exception. When I supply IfNoneMatch, I am explicitly anticipating that I may receive a 304 and have code to handle it as normal, non-exceptional flow.
I am (currently) catching and checking the metadata on the thrown Error, but I expect to check the status code in the
GetObjectCommandOutput
metadata (obj.$metadata.httpStatusCode
) without an exception in this case.Additional context
I am partly filing this because it is not at all clear that this is the intended behavior. It is certainly not what I expeected, and despite searching, I cannot find anything about if it is expected on your end. It was not clear what the
deserializer
in yourdeserializerMiddleware
is expecting after a quick look.I would suggest documenting here the cases where it will throw. For example, if any non-200 is considered to warrant throwing/rejecting, then mention that. However, as I said, I don't see handling this case to be exceptional. I'd prefer to avoid the overhead of error handling for it.
The text was updated successfully, but these errors were encountered: