Skip to content

Commit

Permalink
Set content headers in S3
Browse files Browse the repository at this point in the history
  • Loading branch information
alukach committed Sep 4, 2024
1 parent 08e6fc4 commit cbc085b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/asgi_s3_response_middleware/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .middleware import S3ResponseMiddleware # noqa: F401

__version__ = "0.0.1"
__version__ = "0.0.2"
12 changes: 12 additions & 0 deletions src/asgi_s3_response_middleware/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ async def send_with_s3_response(message: Message):
Params={
"Bucket": self.s3_bucket_name,
"Key": s3_key,
**{
f"ResponseContent{key.title()}": headers[
f"content-{key}"
]
for key in [
"type",
"encoding",
"language",
"disposition",
]
if f"content-{key}" in headers
},
},
ExpiresIn=self.url_expiry,
)
Expand Down

0 comments on commit cbc085b

Please sign in to comment.