8000 Add integration tests for PullFile#download · waynr/github3.py@da391d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit da391d3

Browse files
committed
Add integration tests for PullFile#download
The endpoint that provides the raw content of the pull request file does not provide a content-disposition header (like the Assets API does). If the user doesn't pass an explicit filename, we need to pass one for them.
1 parent 5695b1f commit da391d3

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

github3/pulls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def download(self, path=None):
9494
"""
9595
headers = {'Accept': 'application/octet-stream'}
9696
resp = self._get(self.raw_url, stream=True, headers=headers)
97+
if path is None:
98+
path = self.filename
9799
if self._boolean(resp, 200, 404):
98100
return utils.stream_response_to_file(resp, path)
99101
return None

0 commit comments

Comments
 (0)
0