256 </>
257 );
258 case "fetch":
259 return (
260 <Details
269 summary={(
270 <>
271 <div>fetch:</div>
272 <div>{args?.valPath}</div>
273 <div>{args?.urlPath || "/"}</div>
275 )}>
276 {result?.type === "success" ? (
277 <div className="fetch-result">
278 <div className="fetch-header">
279 <span className={`status-badge ${result.data.status >= 200 && result.data.status < 300 ? 'success' :
280 result.data.status >= 300 && result.data.status < 400 ? 'redirect' :
284 <span className="response-time">{result.data.responseTime}ms</span>
285 </div>
286 <div className="fetch-section">
287 <h4>Headers</h4>
288 <pre className="fetch-headers">{JSON.stringify(result.data.headers, null, 2)}</pre>
289 </div>
290 <div className="fetch-section">
291 <h4>Response Body</h4>
292 <pre className="fetch-body">
293 {typeof result.data.body === 'object'
294 ? JSON.stringify(result.data.body, null, 2)
298 </div>
299 ) : (
300 <div className="fetch-error">
301 <h4>Error</h4>
302 <pre>{result?.message || "Unknown error"}</pre>
6 });
7
8export default app.fetch;
7});
8
9export default app.fetch;
18 const start = performance.now();
19 try {
20 res = await fetch(url);
21 end = performance.now();
22 status = res.status;
28 } catch (e) {
29 end = performance.now();
30 reason = `couldn't fetch: ${e}`;
31 ok = false;
32 }
16
17 try {
18 const response = await fetch('/api/game', {
19 method: 'POST',
20 headers: {
47 const moveData: MoveRequest = { position };
48
49 const response = await fetch(`/api/game/${game.id}/move`, {
50 method: 'PUT',
51 headers: {
27});
28
29export default app.fetch;
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// Send a pushover message.
10 console.log("Tokens:", { PUSHOVER_TOKEN, PUSHOVER_USER_KEY }); // Check if env vars are set
11
12 const response = await fetch("https://api.pushover.net/1/messages.json", {
13 method: "POST",
14 headers: {
14 visited.add(sourceURL);
15
16 const response = await fetch(linkList.original.homepage);
17 // console.log(response);
18 const html = await response.text();
43 // }
44
45 // const response = await fetch(linkObject.homepage);
46 // // console.log(response);
47 // const html = await response.text();
65})
66
67export default app.fetch;
135 const lastSunday = today.startOf("week").minus({ days: 1 });
136
137 // Fetch relevant memories using the utility function
138 const memories = await getRelevantMemories();
139