-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Raise UploadError when HTTP 308 occurs when publishing #3315
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.
Might as well handle the entire 3xx class at this point but LGTM either way.
@@ -46,6 +46,18 @@ def test_uploader_properly_handles_301_redirects(http): | |||
) | |||
|
|||
|
|||
def test_uploader_properly_handles_308_redirects(http): |
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.
To avoid copy-pasting, let's parameterize this test instead.
@@ -272,7 +272,7 @@ def _upload_file( | |||
) | |||
) | |||
bar.finish() | |||
elif resp.status_code == 301: | |||
elif resp.status_code in (301, 308): |
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.
Since we're dropping Python 2 support, let's take advantage of the enums in https://docs.python.org/3/library/http.html#http.HTTPStatus instead of using the raw status codes.
Changes made in this PR were added to the code base. Closing. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Check List
Resolves: #742
Related PR: #3083
I was experiencing HTTP redirect errors on poetry v1.14.0, even though 301 redirects are being handled properly. It appears I was getting a 308. I have added the 308 so that it will be caught and added a new test.
@ObserverOfTime You recently worked on this as well. Could you have a look and share your thoughts?