MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / successValue

Function successValue

sdk/src/__tests__/read-url.test.ts:7–27  ·  view source on GitHub ↗
(
  html: string,
  init?: {
    contentType?: string
    url?: string
  },
)

Source from the content-addressed store, hash-verified

5import { readUrl } from '../tools/read-url'
6
7const successValue = async (
8 html: string,
9 init?: {
10 contentType?: string
11 url?: string
12 },
13) => {
14 const fetch = async () =>
15 new Response(html, {
16 status: 200,
17 headers: {
18 'content-type': init?.contentType ?? 'text/html; charset=utf-8',
19 },
20 })
21
22 const result = await readUrl({
23 url: init?.url ?? 'https://example.com/article',
24 fetch,
25 })
26 return result[0].value
27}
28
29describe('readUrl', () => {
30 it('extracts readable HTML text beyond front-loaded boilerplate', async () => {

Callers 1

read-url.test.tsFile · 0.85

Calls 1

readUrlFunction · 0.90

Tested by

no test coverage detected