-
Notifications
You must be signed in to change notification settings - Fork 180
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
HEAD request not returning custom metadata fields #1160
Comments
@akeustis This is a simple example using the AWS CLI:
|
Thanks so much for your reply. I've replicated your test successfully with or without capitalizing Specifically I'm now 99% sure it has something to do with the EDITED TO ADD: there is a still an issue. See next comment |
On further investigation, I'd like to reopen this. After a whole bunch of debugging I was finally able to discover the problem: the
If we follow that with
then there is a 200 response with no On the the other hand, if we repeat the PUT request with lower-cased This is a problem because the real S3 API does not exhibit this case-sensitive behavior. Furthermore, many commonly used http clients (including Go's |
yeah, we are only looking for lower case header names: also, we only test with the Java SDKv1 and SDKv2 which both send lower case headers when setting userMetadata in the PutObject requests: Let me look into this, shouldn't be too hard to fix. :) |
Thanks again! That would be wonderful. I was able to come up with a workaround and use the Go SDK with a custom middleware that forces the headers to lowercase, but I'd love for no one else to have to face this frustration. |
The previous implementation accepted the headers only in lower case, which is always the case for Java SDKv1 and SDKv2, but not for other SDKs. Fixes #1160
The previous implementation accepted the headers only in lower case, which is always the case for Java SDKv1 and SDKv2, but not for other SDKs. Fixes #1160
@akeustis this was an easy fix, just released 2.13.0 including the fix. |
I'm using S3Mock for integration tests and discovered that S3Mock apparently does not return client-supplied metadata fields when responding to a HEAD request.
When sending a
PutObject
request, any headers the client sends (up to 2KB, I think) starting with theX-Amz-Meta
prefix are supposed to be persisted as object metadata and then returned on bothGetObject
andHeadObject
requests. I know this works in my application with the real S3. In my application it's important to be able to retrieve metadata without having to read the object itself.Unfortunately this did not work when I ran my integration test against S3Mock. I am using the Golang S3 SDK (https://docs.aws.amazon.com/sdk-for-go/api/service/s3) and the
Metadata
map (referenced below) was empty, even though I'm certain it was non-empty with the corresonding PutObject.Here is the documentation for the corresponding
PutObject
field (which is also implemented viaX-Amz-Meta
headers):The text was updated successfully, but these errors were encountered: