(options: Required<DaemonProxyOptions>)
| 87 | } |
| 88 | |
| 89 | async 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 | |
| 104 | async function forwardProxyRequest(params: { |
| 105 | req: IncomingMessage; |
no test coverage detected