Skip to content
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

Fix ExposeHeader XML tag in S3 GetBucketCors response #8407

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion moto/s3/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2994,7 +2994,7 @@ def _invalid_headers(self, url: str, headers: Dict[str, str]) -> bool:
{% endif %}
{% if cors.exposed_headers is not none %}
{% for header in cors.exposed_headers %}
<ExposedHeader>{{ header }}</ExposedHeader>
<ExposeHeader>{{ header }}</ExposeHeader>
{% endfor %}
{% endif %}
{% if cors.max_age_seconds is not none %}
Expand Down
5 changes: 5 additions & 0 deletions tests/test_s3/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2309,6 +2309,11 @@ def test_get_bucket_cors():
resp = s3_client.get_bucket_cors(Bucket=bucket_name)
assert resp["ResponseMetadata"]["HTTPStatusCode"] == 200
assert len(resp["CORSRules"]) == 2
for rules in resp["CORSRules"]:
assert rules["AllowedOrigins"] == ["*"]
assert rules["AllowedHeaders"] == ["Authorization"]
assert rules["ExposeHeaders"] == ["x-amz-request-id"]
assert rules["MaxAgeSeconds"] == 123


@pytest.mark.aws_verified
Expand Down
2 changes: 1 addition & 1 deletion tests/test_s3/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def test_s3_server_post_cors_exposed_header():
assert res.status_code == 200

cors_res = test_client.get("/?cors", "http://testcors.localhost:5000")
assert b"<ExposedHeader>ETag</ExposedHeader>" in cors_res.data
assert b"<ExposeHeader>ETag</ExposeHeader>" in cors_res.data

# Test OPTIONS bucket response and key response
for key_name in ("/", "/test"):
Expand Down
Loading