MCPcopy Index your code
hub / github.com/CommonstackAI/UncommonRoute / handler

Method handler

tests/test_proxy.py:1513–1529  ·  view source on GitHub ↗
(request: httpx.Request)

Source from the content-addressed store, hash-verified

1511 posted_models: list[str] = []
1512
1513 def handler(request: httpx.Request) -> httpx.Response:
1514 body = json.loads(request.content.decode("utf-8"))
1515 posted_models.append(str(body.get("model")))
1516 return httpx.Response(200, json={
1517 "id": "chatcmpl_scene",
1518 "object": "chat.completion",
1519 "choices": [{
1520 "index": 0,
1521 "message": {"role": "assistant", "content": "ok"},
1522 "finish_reason": "stop",
1523 }],
1524 "usage": {
1525 "prompt_tokens": 1,
1526 "completion_tokens": 1,
1527 "total_tokens": 2,
1528 },
1529 })
1530
1531 async_client = httpx.AsyncClient(transport=httpx.MockTransport(handler))
1532 monkeypatch.setattr("uncommon_route.proxy._get_client", lambda: async_client)

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected