Skip to content

Commit

Permalink
fix: accept 201 Created as valid upload response (#141)
Browse files Browse the repository at this point in the history
* fix: accept `201 Created` as valid upload response.

Supersedes: #125

Fixes: #124

* tests: accomodate unit test to extra argument.

Co-authored-by: Lisandro Mc Gough <lisandro78@gmail.com>
  • Loading branch information
tseaver and lisandromc committed Jul 23, 2020
1 parent 68264f8 commit 00d280e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion google/resumable_media/_upload.py
Expand Up @@ -501,7 +501,7 @@ def _process_initiate_response(self, response):
"""
_helpers.require_status_code(
response,
(http_client.OK,),
(http_client.OK, http_client.CREATED),
self._get_status_code,
callback=self._make_invalid,
)
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test__upload.py
Expand Up @@ -507,9 +507,10 @@ def test__process_initiate_response_non_200(self):

error = exc_info.value
assert error.response is response
assert len(error.args) == 4
assert len(error.args) == 5
assert error.args[1] == 403
assert error.args[3] == 200
assert error.args[4] == 201

def test__process_initiate_response(self):
upload = _upload.ResumableUpload(RESUMABLE_URL, ONE_MB)
Expand Down

0 comments on commit 00d280e

Please sign in to comment.