Use Mozilla documentation instead of `httpstatuses.com` for HTTP error reference (#2768)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Zanie · committed by GitHub · parent f6866ce · Browse files · 3 files·+7 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+7 added−7 removed
- tests:+4 added−4 removed
- other:+3 added−3 removed
Provenance
- Commit
18d7721- Tree
13ba117- Author
Zanie <contact@zanie.dev>- Committer
GitHub <noreply@github.com>- Parent
f6866ce
3 files changed+7 added−7 removed
modified:docs/quickstart.md+1 added-1 removed
283 unmodified lines284 Traceback (most recent call last):285 File "/Users/tomchristie/GitHub/encode/httpcore/httpx/models.py", line 837, in raise_for_status286 raise HTTPStatusError(message, response=self)287 httpx._exceptions.HTTPStatusError: 404 Client Error: Not Found for url: https://httpbin.org/status/404288-For more information check: https://httpstatuses.com/404288+For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404289 ```290 291 Any successful response codes will simply return `None` rather than raising an exception.292 243 unmodified linesmodified:httpx/_models.py+2 added-2 removed
727 unmodified lines728 if self.has_redirect_location:729 message = (730 "{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"731 "Redirect location: '{0.headers[location]}'\n"732- "For more information check: https://httpstatuses.com/{0.status_code}"732+ "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"733 )734 else:735 message = (736 "{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"737- "For more information check: https://httpstatuses.com/{0.status_code}"737+ "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"738 )739 740 status_class = self.status_code // 100741 error_types = {468 unmodified linesmodified:tests/models/test_responses.py+4 added-4 removed
100 unmodified lines101 with pytest.raises(httpx.HTTPStatusError) as exc_info:102 response.raise_for_status()103 assert str(exc_info.value) == (104 "Informational response '101 Switching Protocols' for url 'https://example.org'\n"105- "For more information check: https://httpstatuses.com/101"105+ "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101"106 )107 108 # 3xx status codes are redirections.109 headers = {"location": "https://other.org"}3 unmodified lines113 response.raise_for_status()114 assert str(exc_info.value) == (115 "Redirect response '303 See Other' for url 'https://example.org'\n"116 "Redirect location: 'https://other.org'\n"117- "For more information check: https://httpstatuses.com/303"117+ "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303"118 )119 120 # 4xx status codes are a client error.121 response = httpx.Response(403, request=request)2 unmodified lines124 with pytest.raises(httpx.HTTPStatusError) as exc_info:125 response.raise_for_status()126 assert str(exc_info.value) == (127 "Client error '403 Forbidden' for url 'https://example.org'\n"128- "For more information check: https://httpstatuses.com/403"128+ "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403"129 )130 131 # 5xx status codes are a server error.132 response = httpx.Response(500, request=request)2 unmodified lines135 with pytest.raises(httpx.HTTPStatusError) as exc_info:136 response.raise_for_status()137 assert str(exc_info.value) == (138 "Server error '500 Internal Server Error' for url 'https://example.org'\n"139- "For more information check: https://httpstatuses.com/500"139+ "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500"140 )141 142 # Calling .raise_for_status without setting a request instance is143 # not valid. Should raise a runtime error.877 unmodified lines