Allow GithubObject.update() to be passed headers (#1300)

SourceImport.update() is really GithubObject.update(), which just calls
GET on the object's URL. Refetching a source import requires an
additional header, so change GithubObject.update() to pass any it is
given, and add a test for SourceImport.update()

Fixes #1297
This commit is contained in:
Steve Kowalik
2019-11-26 14:29:24 +11:00
committed by GitHub
parent 3170cafce5
commit 989b635e33
4 changed files with 24 additions and 1 deletions
+3 -1
View File
@@ -279,7 +279,7 @@ class CompletableGithubObject(GithubObject):
self._storeAndUseAttributes(headers, data)
self.__completed = True
def update(self):
def update(self, additional_headers=None):
'''
Check and update the object with conditional request
:rtype: Boolean value indicating whether the object is changed
@@ -289,6 +289,8 @@ class CompletableGithubObject(GithubObject):
conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag
if self.last_modified is not None:
conditionalRequestHeader[Consts.REQ_IF_MODIFIED_SINCE] = self.last_modified
if additional_headers is not None:
conditionalRequestHeader.update(additional_headers)
status, responseHeaders, output = self._requester.requestJson(
"GET",