8000 Handle 304 responses from GitHub when users pass etag · domdfcoding/github3.py@d6c2a1c · GitHub
[go: up one dir, main page]

Skip to content

Commit d6c2a1c

Browse files
committed
Handle 304 responses from GitHub when users pass etag
This was an oversight in the behaviour of pre 1.0 _json handling. This commit makes it explicit and should allow it to continue working. Refs sigmavirus24gh-798
1 parent bf44c16 commit d6c2a1c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

github3/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,15 @@ def _json(self, response, expected_status_code, include_cache_info=True):
154154
if actual_status_code != expected_status_code:
155155
if actual_status_code >= 400:
156156
raise exceptions.error_for(response)
157+
158+
if actual_status_code == 304:
159+
# Received a response from someone passing in `etag=`
160+
return None
161+
157162
LOG.warning('Expected status_code %d but got %d',
158163
expected_status_code,
159164
actual_status_code)
165+
160166
try:
161167
ret = response.json()
162168
except ValueError:

0 commit comments

Comments
 (0)
0