Skip to content

Commit

Permalink
Add mimetype and content-disposition headers
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Apr 25, 2024
1 parent 94e0a9b commit aca0755
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions calmerge/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ async def calendar(request: web.Request) -> web.Response:
return web.Response(
body=calendar.to_ical(),
headers={
"Content-Type": "text/calendar",
"Cache-Control": f"max-age={calendar_config.ttl_hours * 60 * 60}",
"Vary": "Authorization",
"Content-Disposition": f"attachment; filename={calendar_config.slug}.ics",
},
)
1 change: 1 addition & 0 deletions tests/test_calendar_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async def test_retrieves_calendars(client: TestClient) -> None:
assert calendar["X-PUBLISHED-TTL"] == "PT12H" # 12 hours

assert response.headers["Cache-Control"] == "max-age=43200"
assert response.headers["Content-Disposition"] == "attachment; filename=python.ics"


async def test_unknown_calendar(client: TestClient) -> None:
Expand Down

0 comments on commit aca0755

Please sign in to comment.