-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: include existing headers in prepare request #309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As talked about in a Chat thread, it appears this reverts fd47338
From what I can tell, that was done purely as an optimization, so I don't see this causing any problems.
I do recommend running this patch against the GCS system tests just to be sure.
tests/unit/test__upload.py
Outdated
@@ -621,12 +621,11 @@ def test__prepare_request_success_with_headers(self): | |||
new_headers = self._prepare_request_helper(headers) | |||
assert new_headers is not headers | |||
expected_headers = { | |||
"cannot": "touch this", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is very subtle and relies on
def _prepare_request_helper(self, headers=None, checksum=None): |
self._upload_in_flight(data, headers=headers, checksum=checksum)
. IIUC, the test is to prevent any regressions from future changes (super not clear by the name of the test).
What I don't understand is what changed when **self._headers
is added so it can be tested. @Breathtender could add a test that validates the behavior change intended by adding **self._headers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Breathtender i spoke with @andrewsg and he clarified what was going on. Apologies, I misread this code block completely. "cannot": "touch this" is a bit distracting and would recommend changing it to: "keep": "must be kept".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's a good change lol
tests/unit/test__upload.py
Outdated
@@ -621,12 +621,11 @@ def test__prepare_request_success_with_headers(self): | |||
new_headers = self._prepare_request_helper(headers) | |||
assert new_headers is not headers | |||
expected_headers = { | |||
"cannot": "touch this", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Breathtender i spoke with @andrewsg and he clarified what was going on. Apologies, I misread this code block completely. "cannot": "touch this" is a bit distracting and would recommend changing it to: "keep": "must be kept".
…media-python into useragent
This is a needed change to allow us to properly set user agent from the python-storage library, for multi-chunked uploads.