Quote names put into SDK client URL paths; share the helper with MCP

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
2026-10-06 17:23:49 +02:00
co-authored by Claude Opus 5.5
parent 847abd67d6
commit 1090bcabfd
3 changed files with 49 additions and 24 deletions
+20
View File
@@ -181,3 +181,23 @@ def test_a_history_is_imported_a_page_at_a_time(monkeypatch):
assert [one["external_id"] for one in answers] == [
e["external_id"] for e in entries
]
def test_a_name_cannot_climb_out_of_its_route(monkeypatch):
"""httpx resolves ``..``, so ``get_flow("../x")`` was ``GET /api/v1/x``."""
seen = []
def handler(request):
seen.append(request.url.raw_path.decode())
return httpx.Response(200, json={})
client = a_client(handler, monkeypatch)
client.get_flow("../x")
client.put_source("..", "../x", "code")
client.run("..")
assert seen == [
"/api/v1/flows/%2E%2E%2Fx",
"/api/v1/flows/%2E%2E/nodes/%2E%2E%2Fx/source",
"/api/v1/runs/%2E%2E",
]