MCPcopy Index your code
hub / github.com/callstack/agent-device / readUpstreamHealth

Function readUpstreamHealth

src/remote/daemon-proxy.ts:89–102  ·  view source on GitHub ↗
(options: Required<DaemonProxyOptions>)

Source from the content-addressed store, hash-verified

87}
88
89async function readUpstreamHealth(options: Required<DaemonProxyOptions>): Promise<unknown> {
90 const upstreamUrl = new URL(buildDaemonHttpUrl(options.upstreamBaseUrl, 'health'));
91 const response = await options.fetchImpl(upstreamUrl, {
92 method: 'GET',
93 headers: buildUpstreamHeaders({ headers: {} }, options.upstreamToken, '/health'),
94 signal: AbortSignal.timeout(options.upstreamTimeoutMs),
95 });
96 const text = await response.text();
97 try {
98 return text ? JSON.parse(text) : { ok: response.ok, status: response.status };
99 } catch {
100 return { ok: response.ok, status: response.status };
101 }
102}
103
104async function forwardProxyRequest(params: {
105 req: IncomingMessage;

Callers 1

sendProxyHealthFunction · 0.85

Calls 3

buildDaemonHttpUrlFunction · 0.90
buildUpstreamHeadersFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected