FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40321: Add missing test, slightly expand documentation by ambv · Pull Request #28760 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 6 additions & 2 deletions Doc/library/urllib.request.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,17 @@ HTTPRedirectHandler Objects
.. method:: HTTPRedirectHandler.http_error_307(req, fp, code, msg, hdrs)

The same as :meth:`http_error_301`, but called for the 'temporary redirect'
response.
response. It does not allow changing the request method from ``POST``
to ``GET``.


.. method:: HTTPRedirectHandler.http_error_308(req, fp, code, msg, hdrs)

The same as :meth:`http_error_301`, but called for the 'permanent redirect'
response.
response. It does not allow changing the request method from ``POST``
to ``GET``.

.. versionadded:: 3.11


.. _http-cookie-processor:
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_urllib2.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ def test_redirect(self):
o = h.parent = MockOpener()

# ordinary redirect behaviour
for code in 301, 302, 303, 307:
for code in 301, 302, 303, 307, 308:
for data in None, "blah\nblah\n":
method = getattr(h, "http_error_%s" % code)
req = Request(from_url, data)
Expand All @@ -1176,8 +1176,8 @@ def test_redirect(self):
method(req, MockFile(), code, "Blah",
MockHeaders({"location": to_url}))
except urllib.error.HTTPError:
# 307 in response to POST requires user OK
self.assertEqual(code, 307)
# 307 and 308 in response to POST require user OK
self.assertIn(code, (307, 308))
self.assertIsNotNone(data)
self.assertEqual(o.req.get_full_url(), to_url)
try:
Expand Down
2 changes: 1 addition & 1 deletion Lib/urllib/request.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Handlers needed to open the requested URL. For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns. The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303, 307 and 308 redirect errors, and the
HTTP 301, 302, 303, 307, and 308 redirect errors, and the
HTTPDigestAuthHandler deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the same as original
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Adds support for HTTP 308 redirects to :mod:`urllib`. Patch by Jochem
Schulenklopper.
Adds support for HTTP 308 redirects to :mod:`urllib`. See :rfc:`7538` for
details. Patch by Jochem Schulenklopper.

Back | FazBrowse Home | New Git URL