#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio import sys sys.path.insert(0, 'ruoyi-fastapi-backend') import httpx async def test(): async with httpx.AsyncClient() as client: # 登录 login_resp = await client.post( "http://localhost:9099/login", data={"username": "admin", "password": "admin123"} ) token = login_resp.json()["token"] print(f"Token: {token[:20]}...") headers = {"Authorization": f"Bearer {token}"} # 测试 pageSize=20 print("\nTesting pageSize=20...") resp = await client.get( "http://localhost:9099/warehouse/receipt/list?pageNum=1&pageSize=20", headers=headers ) print(f"Status: {resp.status_code}") data = resp.json() print(f"Total: {data.get('total')}") print(f"Rows count: {len(data.get('rows', []))}") # 测试 pageSize=10 print("\nTesting pageSize=10...") resp2 = await client.get( "http://localhost:9099/warehouse/receipt/list?pageNum=1&pageSize=10", headers=headers ) data2 = resp2.json() print(f"Total: {data2.get('total')}") print(f"Rows count: {len(data2.get('rows', []))}") asyncio.run(test())