mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Python: Refactor httpx tests
and improve QLDocs a bit
This commit is contained in:
@@ -18,6 +18,11 @@ private import semmle.python.ApiGraphs
|
||||
* - https://www.python-httpx.org/
|
||||
*/
|
||||
private module HttpxModel {
|
||||
/**
|
||||
* An outgoing HTTP request, from the `httpx` library.
|
||||
*
|
||||
* See https://www.python-httpx.org/api/
|
||||
*/
|
||||
private class RequestCall extends HTTP::Client::Request::Range, DataFlow::CallCfgNode {
|
||||
string methodName;
|
||||
|
||||
@@ -47,7 +52,7 @@ private module HttpxModel {
|
||||
/**
|
||||
* Provides models for the `httpx.[Async]Client` class
|
||||
*
|
||||
* See https://www.python-httpx.org/async/
|
||||
* See https://www.python-httpx.org/api/#client
|
||||
*/
|
||||
module Client {
|
||||
/** Get a reference to the `httpx.Client` or `httpx.AsyncClient` class. */
|
||||
|
||||
@@ -15,10 +15,11 @@ response = client.options("url") # $ clientRequestUrlPart="url"
|
||||
response = client.request("method", url="url") # $ clientRequestUrlPart="url"
|
||||
response = client.stream("method", url="url") # $ clientRequestUrlPart="url"
|
||||
|
||||
client = httpx.AsyncClient()
|
||||
response = client.get("url") # $ clientRequestUrlPart="url"
|
||||
response = client.post("url") # $ clientRequestUrlPart="url"
|
||||
response = client.patch("url") # $ clientRequestUrlPart="url"
|
||||
response = client.options("url") # $ clientRequestUrlPart="url"
|
||||
response = client.request("method", url="url") # $ clientRequestUrlPart="url"
|
||||
response = client.stream("method", url="url") # $ clientRequestUrlPart="url"
|
||||
async def async_test():
|
||||
client = httpx.AsyncClient()
|
||||
response = await client.get("url") # $ clientRequestUrlPart="url"
|
||||
response = await client.post("url") # $ clientRequestUrlPart="url"
|
||||
response = await client.patch("url") # $ clientRequestUrlPart="url"
|
||||
response = await client.options("url") # $ clientRequestUrlPart="url"
|
||||
response = await client.request("method", url="url") # $ clientRequestUrlPart="url"
|
||||
response = await client.stream("method", url="url") # $ clientRequestUrlPart="url"
|
||||
|
||||
Reference in New Issue
Block a user