Fix Seerr transport payload forwarding
This commit is contained in:
@@ -113,7 +113,7 @@ class ApiClient:
|
||||
url,
|
||||
headers=self.headers(),
|
||||
params=params,
|
||||
json=payload,
|
||||
payload=payload,
|
||||
)
|
||||
response.raise_for_status()
|
||||
duration_ms = round((time.perf_counter() - started_at) * 1000, 2)
|
||||
|
||||
@@ -459,6 +459,38 @@ class RequestCreationFlowTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertIn("_csrf=secret-value", write_request.headers.get("Cookie", ""))
|
||||
self.assertIn("XSRF-TOKEN=csrf%2Etoken", write_request.headers.get("Cookie", ""))
|
||||
|
||||
async def test_base_request_passes_payload_to_transport_hook(self) -> None:
|
||||
captured: dict = {}
|
||||
|
||||
async def send_request(
|
||||
_client: httpx.AsyncClient,
|
||||
method: str,
|
||||
url: str,
|
||||
*,
|
||||
headers: dict,
|
||||
params: dict | None,
|
||||
payload: dict | None,
|
||||
) -> httpx.Response:
|
||||
captured.update(
|
||||
method=method,
|
||||
url=url,
|
||||
headers=headers,
|
||||
params=params,
|
||||
payload=payload,
|
||||
)
|
||||
return httpx.Response(200, request=httpx.Request(method, url), json={"ok": True})
|
||||
|
||||
client = requests_router.JellyseerrClient("https://seerr.test", "api-key")
|
||||
with patch.object(client, "_send_request", new=send_request):
|
||||
result = await client._request(
|
||||
"POST",
|
||||
"/api/v1/request",
|
||||
payload={"mediaType": "movie", "mediaId": 209112},
|
||||
)
|
||||
|
||||
self.assertEqual(result, {"ok": True})
|
||||
self.assertEqual(captured["payload"], {"mediaType": "movie", "mediaId": 209112})
|
||||
|
||||
async def test_request_destination_only_offers_live_sonarr_profiles(self) -> None:
|
||||
runtime = SimpleNamespace(
|
||||
sonarr_base_url="http://sonarr.test",
|
||||
|
||||
Reference in New Issue
Block a user