Skip to content

Commit

Permalink
transfer-encoding: chunked for DB downloads, refs #749
Browse files Browse the repository at this point in the history
This should get >32MB downloads working on Cloud Run.
  • Loading branch information
simonw committed Dec 2, 2020
1 parent a970276 commit 88ac538
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions datasette/views/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ async def view_get(self, request, database, hash, correct_hash_present, **kwargs
headers = {}
if self.ds.cors:
headers["Access-Control-Allow-Origin"] = "*"
headers["Transfer-Encoding"] = "chunked"
return AsgiFileDownload(
filepath,
filename=os.path.basename(filepath),
Expand Down
1 change: 1 addition & 0 deletions tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ def test_database_download_for_immutable():
download_response.headers["content-disposition"]
== 'attachment; filename="fixtures.db"'
)
assert download_response.headers["transfer-encoding"] == "chunked"


def test_database_download_disallowed_for_mutable(app_client):
Expand Down

0 comments on commit 88ac538

Please sign in to comment.