Skip to content

Commit

Permalink
Fix content-disposition handling - add test
Browse files Browse the repository at this point in the history
  • Loading branch information
iainrussell committed Nov 11, 2024
1 parent 1142127 commit 0b75814
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pytest

from multiurl import Downloader, download
from multiurl.http import FullHTTPDownloader


def test_http():
Expand Down Expand Up @@ -77,6 +78,18 @@ def test_order():
assert f.read()[:4] == b"BUFR"


def test_content_disposition_handling():
class TestDownloader(FullHTTPDownloader):
def headers(self):
headers = super().headers()
headers["content-disposition"] = 'attachment; filename="temp.bufr"'
return headers

TestDownloader(
url="http://get.ecmwf.int/test-data/metview/gallery/temp.bufr",
).download(target="out")


@pytest.mark.skip(reason="ftpserver not defined")
def test_ftp_download(tmp_path, ftpserver):
local_test_file = os.path.join(tmp_path, "testfile.txt")
Expand Down

0 comments on commit 0b75814

Please sign in to comment.