axios+telemetry cleanup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import { nativeRequest } from '../utils/http.js'
|
||||
import { getOauthConfig } from '../constants/oauth.js'
|
||||
import type { SDKMessage } from '../entrypoints/agentSdkTypes.js'
|
||||
import { logForDebugging } from '../utils/debug.js'
|
||||
@@ -47,14 +47,18 @@ async function fetchPage(
|
||||
params: Record<string, string | number | boolean>,
|
||||
label: string,
|
||||
): Promise<HistoryPage | null> {
|
||||
const resp = await axios
|
||||
.get<SessionEventsResponse>(ctx.baseUrl, {
|
||||
const queryString = new URLSearchParams(
|
||||
Object.entries(params).map(([k, v]) => [k, String(v)]),
|
||||
).toString()
|
||||
const url = queryString ? `${ctx.baseUrl}?${queryString}` : ctx.baseUrl
|
||||
const resp = await nativeRequest<SessionEventsResponse>(
|
||||
url,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: ctx.headers,
|
||||
params,
|
||||
timeout: 15000,
|
||||
validateStatus: () => true,
|
||||
})
|
||||
.catch(() => null)
|
||||
},
|
||||
).catch(() => null)
|
||||
if (!resp || resp.status !== 200) {
|
||||
logForDebugging(`[${label}] HTTP ${resp?.status ?? 'error'}`)
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user