Skip to content

Commit 0fe9620

Browse files
committed
fix(self-hosting): keep a metadata 200 when its body fails to read
1 parent 8280b4d commit 0fe9620

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/sim/lib/execution/remote-sandbox/kubernetes/confinement-probe.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,15 @@ def http_status(url, headers=None, method='GET', timeout=4):
151151
request = urllib.request.Request(url, headers=headers or {}, method=method)
152152
try:
153153
response = direct.open(request, timeout=timeout)
154-
return response.status, response.read(4096).decode('utf-8', 'replace')
155154
except urllib.error.HTTPError as error:
156155
return error.code, ''
157156
except Exception:
158157
return 'unreachable', ''
158+
# The status is the verdict; a body that fails to read must not hide a 200.
159+
try:
160+
return response.status, response.read(4096).decode('utf-8', 'replace')
161+
except Exception:
162+
return response.status, ''
159163
160164
def imds_headers(address):
161165
status, token = http_status(

0 commit comments

Comments
 (0)