Further updates to web_fetch
This commit is contained in:
@@ -157,6 +157,23 @@ test('bareWebFmtErr null/undefined and node-like errors', async (t) => {
|
||||
t.ok(fmt(withCause).includes('inner'))
|
||||
})
|
||||
|
||||
test('bareWebRunTool without timeout_ms uses finite default (not NaN)', async (t) => {
|
||||
const fetchFn = async () =>
|
||||
new Response('<html><head><title>ok</title></head></html>', {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'text/html; charset=utf-8' }
|
||||
})
|
||||
const s = loadSandbox({ fetch: fetchFn })
|
||||
const run = /** @type {typeof bareWebRunTool} */ (s.bareWebRunTool)
|
||||
const out = await run({
|
||||
ctx: { httpFetch: fetchFn },
|
||||
url: 'https://x.test/',
|
||||
format: 'meta'
|
||||
})
|
||||
t.ok(out.ok)
|
||||
t.absent(JSON.stringify(out).includes('NaN'))
|
||||
})
|
||||
|
||||
test('bareWebRunTool timeout passes abort reason (matches bare-fetch contract)', async (t) => {
|
||||
/** Simulates bare-fetch: rejects with `signal.reason` when aborted. */
|
||||
const fetchFn = async (_url, init) => {
|
||||
|
||||
Reference in New Issue
Block a user