pod_http: delegate ordinary URLs to requests' own verbs

So callers and tests that patch requests.get/post keep working; only
https-to-a-bare-IP takes the pinned path.
Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
parent d83404ae
......@@ -92,13 +92,21 @@ def request(method: str, url: str, **kw):
return requests.request(method, url, **kw)
# The verb helpers delegate to requests' own verbs for ordinary URLs, not to
# requests.request: callers (and tests) that patch requests.get keep working.
def get(url: str, **kw):
return request("GET", url, **kw)
if is_pinned_url(url):
return request("GET", url, **kw)
return requests.get(url, **kw)
def post(url: str, **kw):
return request("POST", url, **kw)
if is_pinned_url(url):
return request("POST", url, **kw)
return requests.post(url, **kw)
def head(url: str, **kw):
return request("HEAD", url, **kw)
if is_pinned_url(url):
return request("HEAD", url, **kw)
return requests.head(url, **kw)
......@@ -454,7 +454,7 @@ def test_venv_on_volume_uses_a_small_image_and_the_volumes_venv(monkeypatch):
script = plan["start_cmd"][0]
assert "/workspace/venvs/embeddings" in script
assert "profiles/embeddings.txt" in script # the right profile installed
assert script.rstrip().endswith("--port 8000")
assert "--port 8000" in script.rstrip().splitlines()[-1] # (+ TLS args when sent)
def test_venv_on_volume_without_a_volume_is_refused(monkeypatch):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment