feat(rpc): support POST method

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-02-07 00:49:34 -08:00
parent 26f0b014f9
commit 2dfa41c9a5
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 75 additions and 16 deletions

View file

@ -782,3 +782,16 @@ def test_rpc_jsonp_callback(client: TestClient):
response = request.get("/rpc", params=params)
assert response.headers.get("content-type") == "application/json"
assert response.json().get("error") == "Invalid callback name."
def test_rpc_post(client: TestClient, packages: List[Package]):
data = {
"v": 5,
"type": "info",
"arg": "big-chungus",
"arg[]": ["chungy-chungus"]
}
with client as request:
resp = request.post("/rpc", data=data)
assert resp.status_code == int(HTTPStatus.OK)
assert resp.json().get("resultcount") == 2