Spaces:
Running
Running
File size: 1,413 Bytes
a0c82c7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import asyncio
import httpx
import uuid
async def test_webhook():
# Use a valid UUID to avoid 422 if validation is strict
tenant_id = str(uuid.uuid4())
url = f"http://localhost:8000/api/v1/webhook/evolution/{tenant_id}"
print(f"Testing URL: {url}")
try:
async with httpx.AsyncClient() as client:
# Send an empty JSON or minimal payload
response = await client.post(url, json={"type": "test"})
print(f"Status Code: {response.status_code}")
print(f"Response: {response.text}")
if response.status_code == 404:
print("β Endpoint NOT FOUND (404)")
elif response.status_code == 405:
print("β Method Not Allowed (405) - Check if POST is correct")
elif response.status_code == 400:
print("β
Endpoint exists (400 Bad Request is expected for invalid payload)")
elif response.status_code == 422:
print("β
Endpoint exists (422 validation error is expected)")
elif response.status_code == 200:
print("β
Endpoint works!")
else:
print(f"β οΈ Unexpected status: {response.status_code}")
except Exception as e:
print(f"β Connection failed: {e}")
if __name__ == "__main__":
asyncio.run(test_webhook())
|