Skip to content

Commit b2b2040

Browse files
committed
fix: add SSE Accept header to health check request
The CodeGraph HTTP server's /health endpoint requires SSE headers. Added 'Accept: text/event-stream' header to the health check request to prevent 406 Not Acceptable errors. This fixes the issue where health checks fail with: 'Not Acceptable: Client must accept text/event-stream' even when the server is running correctly.
1 parent dab9d70 commit b2b2040

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

test_agentic_mcp.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,34 +328,40 @@ async def run_http_tests():
328328
try:
329329
import httpx
330330
async with httpx.AsyncClient() as client:
331+
# Try health check with SSE headers (server may require them)
331332
response = await client.get(
332333
f"http://{HTTP_HOST}:{HTTP_PORT}/health",
333334
timeout=2.0,
334-
follow_redirects=True
335+
follow_redirects=True,
336+
headers={
337+
"Accept": "text/event-stream, application/json, */*"
338+
}
335339
)
336340
if response.status_code != 200:
337341
print(f"❌ Health check failed: HTTP {response.status_code}")
338342
print(f" Response: {response.text[:200] if response.text else 'empty'}")
339-
print(f"\n⚠️ Common port configuration issues:")
340-
print(f" - Port {HTTP_PORT} may be wrong")
341-
print(f" - Default HTTP server port: 3000")
342-
print(f" - SurrealDB port (NOT for HTTP): 3004")
343-
print(f" - Check CODEGRAPH_HTTP_PORT in .env file")
344-
print(f"\nStart CodeGraph HTTP server on correct port:")
345-
print(f" ./target/release/codegraph start http --host {HTTP_HOST} --port 3000")
343+
print(f"\n⚠️ Troubleshooting:")
344+
print(f" - Is the CodeGraph HTTP server running on port {HTTP_PORT}?")
345+
print(f" - Check: ps aux | grep codegraph")
346+
print(f" - Try: curl -H 'Accept: text/event-stream' http://{HTTP_HOST}:{HTTP_PORT}/health")
347+
print(f"\nStart HTTP server with:")
348+
print(f" ./target/release/codegraph start http --host {HTTP_HOST} --port {HTTP_PORT}")
346349
return 1
347350
print("✓ Server is reachable\n")
348351
except Exception as e:
349352
print(f"❌ Cannot reach server: {e}")
350353
print(f"\n⚠️ Troubleshooting:")
351354
print(f" - Is the server running? Check: ps aux | grep codegraph")
352-
print(f" - Wrong port? Common mistake: using 3004 (SurrealDB) instead of 3000 (HTTP)")
355+
print(f" - Wrong port? Common ports:")
356+
print(f" - 3000: Default HTTP server port")
357+
print(f" - 3003: Your configured port (CODEGRAPH_HTTP_PORT)")
358+
print(f" - 3004: SurrealDB (NOT for HTTP)")
353359
print(f" - Check firewall/network: curl http://{HTTP_HOST}:{HTTP_PORT}/health")
354360
print(f"\nExpected .env configuration:")
355-
print(f" CODEGRAPH_HTTP_HOST=127.0.0.1")
356-
print(f" CODEGRAPH_HTTP_PORT=3000 # HTTP server port (NOT SurrealDB 3004)")
361+
print(f" CODEGRAPH_HTTP_HOST={HTTP_HOST}")
362+
print(f" CODEGRAPH_HTTP_PORT={HTTP_PORT}")
357363
print(f"\nStart HTTP server with:")
358-
print(f" ./target/release/codegraph start http --host 127.0.0.1 --port 3000")
364+
print(f" ./target/release/codegraph start http --host {HTTP_HOST} --port {HTTP_PORT}")
359365
return 1
360366

361367
results = []

0 commit comments

Comments
 (0)