Closed iw108 closed 3 weeks ago
Hi, thanks for using S3Mock :)
We have two integration tests for setting and retrieving tags on objects using the V1 and V2 AWS SDKs for Java: https://github.com/adobe/S3Mock/blob/main/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ObjectTaggingV1IT.kt https://github.com/adobe/S3Mock/blob/main/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ObjectTaggingV2IT.kt
How are you accessing the API?
Cheers, Arne
Hi,
Thanks for getting back in touch! I've tried with the aws cli and also aiobotocore, e.g.
touch example.txt
aws s3api create-bucket \
--bucket x \
--endpoint http://localhost:9090
aws s3api put-object \
--body example.txt \
--bucket x \
--key y.txt \
--endpoint http://localhost:9090
# This works
aws s3api get-object-tagging \
--bucket x \
--key y.txt \
--endpoint http://localhost:9090
# This doesn't
aws s3api put-object-tagging \
--tagging '{"TagSet": [{"Key": "a", "Value": "b"}]' \
--bucket x \
--key y.txt \
--endpoint http://localhost:9090
not sure how aiobotocore produces the payload, but your AWS CLI payload is not valid JSON:
'{"TagSet": [{"Key": "a", "Value": "b"}]'
you're missing the closing curly bracket. The payload should be:
'{"TagSet": [{"Key": "a", "Value": "b"}]'}
Sorry about the typo above, with the correct payload the server returns a 400 error
ok, I could reproduce this locally. The API strictly lists XML as the only valid input for this API (AFAIK, this is the case for all S3 APIs): https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html
The AWS CLI does not set application/xml
as the content-type, which S3Mock currently enforces for all APIs accepting XML as input.
The Java SDKs always set the correct header, that's why the tests are passing.
Thanks for the explanation!
Is there any way the server side content-type checks can be relaxed?
sure, that should be possible. I'll look into it next week. :)
@iw108 I released 3.10.0
that supports these requests. :)
Hi,
Great work with the project, it's very useful!
I am currently trying to set some tags (
PutObjectTagging
) on an object, however the server always returns a 400 response. Do you have any ideas what's causing this? I am able to retrieve tags without a problem.Thanks in advance!