Skip to content

Commit d3a7304

Browse files
fixed download
1 parent ebf72f3 commit d3a7304

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/pytfe/resources/state_versions.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,9 @@ def download(self, state_version_id: str) -> bytes:
272272
raise NotFound("download url not available for this state version")
273273

274274
# Download the bytes from the signed Archivist URL (follow redirects).
275-
# Avoid API default headers here; Accept */* is fine.
275+
# Avoid JSON:API headers here; Accept */* is fine.
276276
resp = self.t.request(
277-
"GET",
278-
url,
279-
allow_redirects=True,
280-
headers={"Accept": "*/*"},
277+
"GET", url, allow_redirects=True, headers={"Accept": "application/json"}
281278
)
282279
return resp.content
283280

@@ -293,10 +290,7 @@ def download_current(self, workspace_id: str) -> bytes:
293290

294291
raise NotFound("download url not available for current state")
295292
resp = self.t.request(
296-
"GET",
297-
url,
298-
allow_redirects=True,
299-
headers={"Accept": "*/*"},
293+
"GET", url, allow_redirects=True, headers={"Accept": "*/*"}
300294
)
301295
return resp.content
302296

tests/units/test_state_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def test_download_state_version_success(
365365
"GET",
366366
"https://example.com/signed-download",
367367
allow_redirects=True,
368-
headers={"Accept": "*/*"},
368+
headers={"Accept": "application/json"},
369369
)
370370
assert result == b"{}"
371371

0 commit comments

Comments
 (0)