Repository navigation
Conversation
The top-level httpx.get() and httpx.request() functions do not accept an extensions argument, so both examples raised TypeError. Use a Client, as the other examples on the page do, and send OPTIONS * to match the text describing server-wide OPTIONS * requests.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The two code examples for the
"target"request extension indocs/advanced/extensions.mdfail when run as written.extensions=to the top-levelhttpx.get()andhttpx.request()functions. Those functions (httpx/_api.py) do not take anextensionsargument; only theClientmethods do. Both examples raiseTypeErrorbefore any request is sent.OPTIONS *request, but the example comment and call useCONNECT.This PR switches both examples to
client = httpx.Client()+client.get(...)/client.request(...), the same style the other examples on that page already use, and changes the second example toOPTIONS.How I checked it: I extracted the two python blocks of the
"target"section verbatim, replaced only the URL with a local TCP server, executed them with httpx 1.0.0 (installed frommaster), and recorded the request line the server received.Before:
After:
No other page under
docs/passesextensions=to the top-level API.Checklist