MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / fetchAs

Function fetchAs

data-browser/src/routes/DataRoute.tsx:36–53  ·  view source on GitHub ↗
(contentType: string)

Source from the content-addressed store, hash-verified

34 }
35
36 async function fetchAs(contentType: string) {
37 let headers: HeadersInit = new Headers();
38 headers.set('Accept', contentType);
39 if (agent) {
40 headers = await signRequest(subject, agent, headers);
41 }
42 setTextResponseLoading(true);
43 try {
44 const resp = await window.fetch(subject, { headers });
45 const body = await resp.text();
46 setTextResponseLoading(false);
47 setTextResponse(body);
48 setErr(null);
49 } catch (e) {
50 setTextResponseLoading(false);
51 setErr(e);
52 }
53 }
54
55 return (
56 <ContainerNarrow about={subject}>

Callers 1

DataFunction · 0.85

Calls 2

signRequestFunction · 0.90
setMethod · 0.80

Tested by

no test coverage detected