test(e2e): get_text_external accepts JSON next to text so a pod-log error reads as the Kubernetes Status, not a 406 (#47150)

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Kerry Lu 2026-10-17 13:25:29 -07:00 • committed by GitHub
parent 0f007c05fc
commit 90fccd4d87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -507,11 +507,12 @@ def get_text_external(
ca_bundle: str | None = None,
) -> str | NetworkError:
"""GET an absolute URL outside the proxy whose body is plain text (e.g. a pod log), not JSON.
A non-2xx status is reported as a NetworkError so the caller can fail loudly."""
A non-2xx status is reported as a NetworkError so the caller can fail loudly. JSON is accepted too so an API
that answers an error as a JSON document (the Kubernetes Status on a pod log) returns that error instead of a 406."""
try:
resp = requests.get(
url,
headers={"Accept": "text/plain", **(_headers(headers) if headers is not None else {})},
headers={"Accept": "text/plain, application/json", **(_headers(headers) if headers is not None else {})},
timeout=timeout,
verify=ca_bundle if ca_bundle is not None else True,
)