Use Mozilla documentation instead of httpstatuses.com for HTTP error reference (#2768)

This commit is contained in:
Zanie 2023-07-13 15:17:07 -05:00 committed by GitHub
parent f6866ce388
commit 18d7721c38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -285,7 +285,7 @@ Traceback (most recent call last):
File "/Users/tomchristie/GitHub/encode/httpcore/httpx/models.py", line 837, in raise_for_status
raise HTTPStatusError(message, response=self)
httpx._exceptions.HTTPStatusError: 404 Client Error: Not Found for url: https://httpbin.org/status/404
For more information check: https://httpstatuses.com/404
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
```
Any successful response codes will simply return `None` rather than raising an exception.

View File

@ -729,12 +729,12 @@ class Response:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"Redirect location: '{0.headers[location]}'\n"
"For more information check: https://httpstatuses.com/{0.status_code}"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
else:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"For more information check: https://httpstatuses.com/{0.status_code}"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
status_class = self.status_code // 100

View File

@ -102,7 +102,7 @@ def test_raise_for_status():
response.raise_for_status()
assert str(exc_info.value) == (
"Informational response '101 Switching Protocols' for url 'https://example.org'\n"
"For more information check: https://httpstatuses.com/101"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101"
)
# 3xx status codes are redirections.
@ -114,7 +114,7 @@ def test_raise_for_status():
assert str(exc_info.value) == (
"Redirect response '303 See Other' for url 'https://example.org'\n"
"Redirect location: 'https://other.org'\n"
"For more information check: https://httpstatuses.com/303"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303"
)
# 4xx status codes are a client error.
@ -125,7 +125,7 @@ def test_raise_for_status():
response.raise_for_status()
assert str(exc_info.value) == (
"Client error '403 Forbidden' for url 'https://example.org'\n"
"For more information check: https://httpstatuses.com/403"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403"
)
# 5xx status codes are a server error.
@ -136,7 +136,7 @@ def test_raise_for_status():
response.raise_for_status()
assert str(exc_info.value) == (
"Server error '500 Internal Server Error' for url 'https://example.org'\n"
"For more information check: https://httpstatuses.com/500"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500"
)
# Calling .raise_for_status without setting a request instance is